ibook
Ctrlk
  • README
  • cheatsheet
  • vim
  • devops
  • jenkins
    • config
    • appearance
    • troubleshooting
    • jenkinsfile
    • script
    • api
    • 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
  • ai
  • osx
  • linux
  • programming
  • tools
  • quotes
  • english
Powered by GitBook
On this page
  1. jenkins
  2. plugins

job-dsl

  • dsl in jenkinsfile

    • create folder

references:

  • * 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

  • or via ExecuteDslScripts

create folder

  • or via ExecuteDslScripts

Previousjira-stepsNextbuild-timeline

Last updated 1 year ago

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
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
timestamps { ansiColor('xterm') {
  node('built-in') {

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

  } // node
}} // ansiColor | timestamps
step([
  $class: 'ExecuteDslScripts',
      scriptText: """
        folder('dsl/guardian') {
          displayName('guardian')
          description('for dsl guardian demo')
        }
      """ ,
      lookupStrategy: 'JENKINS_ROOT',
      removedJobAction: 'DELETE',
      removedViewAction: 'DELETE',
      sandbox: true
])