book
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page

Was this helpful?

  1. jenkins
  2. plugins

job-dsl

Previousjira-stepsNextbuild-timeline

Last updated 1 year ago

Was this helpful?

references:

dsl in jenkinsfile

timestamps { ansiColor('xterm') {
  node('built-in') {

    jobDsl (
      sandbox: true,
      scriptText: '''
        pipelineJob(\'github-demo\') {
          definition {
            cpsScm {
              scm {
                git {
                  remote { github(\'jenkinsci/pipeline-examples\') }
                }
              }
              scriptPath(\'declarative-examples/simple-examples/environmentInStage.groovy\')
            }
          }
        }
      '''
    ) // jobDsl

  } // node
}} // ansiColor | timestamps
  • or via ExecuteDslScripts

    step ([
      $class: 'ExecuteDslScripts' ,
        scriptText: """
          pipelineJob('dsl/guardian/demo') {
            definition {
              cpsScm {
                scm {
                  git {
                    remote { github('jenkinsci/pipeline-examples') }
                  }
                }
                scriptPath( 'declarative-examples/simple-examples/environmentInStage.groovy' )
              }
            }
          }
        """.stripIndent() ,
        sandbox: true
      ]) // steps

create folder

timestamps { ansiColor('xterm') {
  node('built-in') {

    jobDsl (
      ignoreExisting: true,
      sandbox: true,
      scriptText: '''folder(\'dsl\') {
        displayName(\'dsl\')
        description(\'for dsl demo\')
      }'''
    )

  } // node
}} // ansiColor | timestamps
  • or via ExecuteDslScripts

    step([
      $class: 'ExecuteDslScripts',
          scriptText: """
            folder('dsl/guardian') {
              displayName('guardian')
              description('for dsl guardian demo')
            }
          """ ,
          lookupStrategy: 'JENKINS_ROOT',
          removedJobAction: 'DELETE',
          removedViewAction: 'DELETE',
          sandbox: true
    ])
* jenkinsci/job-dsl-plugin
User Power Moves
Run a DSL Script locally
Job DSL Commands
Talks and Blog Posts
Real World Examples
Testing DSL Scripts
* jenkins-pipeline-library/jobs/devops/seed.groovy
* Jenkins DSL seed job
Jenkins Tutorial
* Jenkins Tutorial: Implementing a Seed Job
* Jenkins Tutorial: Creating Jobs with the Jenkins Job DSL
* User Power Moves
Use Job DSL in Pipeline scripts
* Getting Started With Jenkins Job DSL Plugin for Standardising Your Pipelines
jamietanna/job-dsl-example
Configuring a Jenkins Multibranch Pipeline to Specify the Trust Permissions with Job DSL
Building a Multibranch Pipeline on a Schedule
Ensuring Consistent Code Style with Job DSL Repos
Configuring a Jenkins Multibranch Pipeline to Use an External Script with Job DSL
* Jenkins DSL seed job
Jenkins: 使用groovy + job-dsl 创建并触发job
Jenkins Job DSL API
Groovy DSL is not working
job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy
Using Jenkins Job DSL plugin to automatically create and configure projects with Perforce
Jenkins-as-code
Jenkins-as-code: job-dsl-plugin
Jenkins-as-code: comparing job-dsl and Pipelines
Jenkins-as-code: registering jobs for automatic seed job creation
How To Automate Jenkins Setup with Docker and Jenkins Configuration as Code
dsl in jenkinsfile
create folder