Questions tagged [jcasc]

Jenkins Configuration as Code (a.k.a. JCasC) Plugin. A way to configure Jenkins based on human-readable declarative configuration files.

You should use the tag for questions related to the Configuration as Code plugin.

42 questions
6
votes
1 answer

Jenkins reports a cycle dependcy error with plugins after restart and will not start now

We restarted our jenkins LTS 2.303.3 (which redownloads all plugins upon restart with the JCaSC plugin) and are seeing these errors in the logs: 2022-07-27 17:59:00.565+0000 [id=31] SEVERE hudson.PluginManager$1$3$2$1#reactOnCycle: found cycle in…
BLang
  • 930
  • 3
  • 16
  • 35
6
votes
1 answer

Jenkins configuration as code: programmatically reload configuration from file

How to reload Jenkins configuration as code file from within groovy script? (Equivalent of clicking on "Reload existing configuration")
3
votes
1 answer

When fetching Job DSL scripts from a file. How do I accomplish this inside jenkins helm chart jcasc section as well as format?

What I understand so far: This makes sense, i pass a file in instead of hardcoding the script values jobs: - script: > multibranchPipelineJob('configuration-as-code') { branchSources { git { id =…
shan
  • 125
  • 3
  • 16
2
votes
0 answers

How to properly initialize jobs configured by Jenkins Configuration as Code plugin?

Context I have a few Jenkins jobs stored as declarative pipelines in a given repository. Then, I'm using Jenkins Configuration as code configuration YAML as follows to load them from that repository: jobs: - script: > pipelineJob('job-A') { …
Adam
  • 737
  • 1
  • 6
  • 20
2
votes
2 answers

How to create users and passwords for Jenkins using JCASC

I am trying to create a user and password for Jenkins using JCASC. I can set up Jenkins however when I go to the GUI on my local host I do not see any users. Here is my code jenkins: systemMessage: "Jenkins configured automatically by Jenkins…
Matt Salem
  • 75
  • 8
2
votes
1 answer

What is JCasc / Job DSL option for "Build when a change is pushed to BitBucket" flag?

I am trying to use jenkins helm chart that uses Jcasc and JobDSL for job configuration. I have configured organizationFolder with bitbucket config inside that traverses my bitbucket repos and creates multibranchPipeline jobs. Looks good and receives…
ludenus
  • 1,161
  • 17
  • 30
2
votes
1 answer

Are there any api's available to automate the "Apply new configuration" action in Jenkins Configuration as Code plugin

How can I apply a new Jenkins configuration as code YAML file from a groovy script, similar to clicking the "Apply new configuration" button in the UI.
2
votes
1 answer

Build Periodically Syntax for Jenkins Configuration as Code Plug-In (JCasC)

I'm trying to use the configuration as code (JCasC) plug-in to create a pipeline job that builds periodically, but I can't find the syntax for this anywhere online. I'm writing the configuration in YAML. The "Build Periodically" field is under…
Katie
  • 23
  • 5
2
votes
2 answers

How to create a jenkins pipelineJob via Configuration as code?

I want to create a simple pipeline job in my Jenkins configuration with a script. So my jenkins.yaml file is as follow: jobs: - script: > pipelineJob('Tag Repositories') { definition { cps { def theScript =…
xbmono
  • 2,084
  • 2
  • 30
  • 50
1
vote
1 answer

Jenkins JCASC Kubernetes plugin - Allow podTemplate to have YAML

I'm using Jenkins configuration as code (JCASC). I'm having a pod template and I want to add NodeSelector + Tolerations. podTemplate doesn't support key of tolerations and NodeSelector so I need to add pod YAML spec... agent: enabled:…
EilonA
  • 361
  • 5
  • 17
1
vote
0 answers

Jcasc and credentials as a kubernetes secret

I've defined Jenkins credentials as a kubectl secrets. apiVersion: v1 kind: Secret metadata: name: "git" labels: "jenkins.io/credentials-type": "basicSSHUserPrivateKey" annotations: "jenkins.io/credentials-description" : "private…
syncerror
  • 131
  • 1
  • 10
1
vote
1 answer

JCasC. Pipeline code in jobs.jcasc.yaml file

I'm trying to configure Jenkins as a code, and trying to put pipeline code in configuration. So far I've found in doc (https://github.com/jenkinsci/job-dsl-plugin/tree/master/docs) that I can do it if I pull the script from Git, but since my…
syncerror
  • 131
  • 1
  • 10
1
vote
4 answers

Provide external yaml file to JCasC configScripts

I am configuring my Jenkins instance using jenkins-helm chart (https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/VALUES_SUMMARY.md#jenkins-configuration-as-code-jcasc) Currently Jenkins config is provided in values.yaml as: jenkins: …
ShailyAggarwal
  • 813
  • 9
  • 20
1
vote
1 answer

Jenkins configuration as a code migration

We have a jenkins instance with stable repository helm charts. As stable charts are deprecated, we are trying to upgrade our jenkins with jenkinsci/helm-chart repository. How to migrate our existing configuration to JCasc through helm chart?
1
vote
1 answer

Pass variable to JobDsl seed job (Jenkins) in scriptText?

I am working on a project and i have to configure a jenkins using JCasC (config as code plugin). I have to create a job BUT i can't pass variables in the script. My code: freeStyleJob("SEED") { parameters { …
Theo Cerutti
  • 779
  • 1
  • 10
  • 33
1
2 3