Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins CASC Folder Syntax: How to organise pipelinescript-defined job files into folders? #2529

Open
archmangler opened this issue Jul 14, 2024 · 0 comments

Comments

@archmangler
Copy link

Describe your use-case which is not covered by existing documentation.

I have the following Jenkins CASC syntax which works well to create folders in the Jenkins U.I.

.
.
.
jenkins:
  securityRealm:
    local:
      allowsSignup: false
      users:
        # create a user called admin
        - id: "admin"
          password: "admin"
  authorizationStrategy: loggedInUsersCanDoAnything

#numExecutors: 1

#Job Definitions using job-dsl plugin
jobs:
  - script: folder('Non-Production-CAF/bootstrap')
  - file: /usr/local/bootstrap-levels-test-nprd.groovy
 

However I can find nothing in the Jenkins CASC docs on how to simply organise these jobs (defined by groovy declarative pipelinescript) into folders. I have tried this:


#Job Definitions using job-dsl plugin
jobs:
  - script: folder('Production-CAF')
.
.
.
  - script: folder('Non-Production-CAF/bootstrap')
  - script: file('Non-Production-CAF/bootstrap/bootstrap-levels-nprd.groovy')
.
.
.
  - file: /var/jenkins_home/jobs/Non-Production-CAF/bootstrap/bootstrap-levels-nprd.groovy

But the pipelinescript groovy "bootstrap-levels-nprd.groovy" is not interpreted and instantiated as a job in the folder "Non-Production-CAF/bootstrap/".

Does the folder plugin CASC support this ?
If so please can we have a documentation example for exactly this case?

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

  1. https://plugins.jenkins.io/cloudbees-folder/
  2. https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-DSL-Commands#folder
@archmangler archmangler added the documentation A PR that adds to documentation - used by Release Drafter label Jul 14, 2024
@timja timja removed the documentation A PR that adds to documentation - used by Release Drafter label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants