Skip to content

Migration

Jamie Tanna edited this page Jul 18, 2022 · 51 revisions

Migrating to 1.81

PostBuildScript plugin

There are no longer any manually defined DSL methods for the PostBuildScript, which allows folks using PostBuildScript v3.0.0 to no longer have issues with Job DSL (JENKINS-66189).

Note that this did not go through a deprecation cycle, as we usually should do, in a decision by the maintainers regarding how few folks still use the v2.x release, and the age of the plugin.

Migrating to 1.77

Pipeline: Job Plugin

The triggers option for Pipeline jobs causes problems (JENKINS-53775). It is deprecated and will be removed. It should be replaced by the pipelineTriggers job property. The dynamic DSL syntax for pipeline triggers differs from the built-in syntax, use the embedded API viewer to look-up the exact syntax.

DSL prior to 1.77

pipelineJob('example') {
    triggers {
        cron('@daily')
    }
}

DSL since 1.77

pipelineJob('example') {
    properties {
        pipelineTriggers {
            triggers {
                cron {
                    spec('@daily')
                }
            }
        }
    }
}

Migrating to 1.76

Pipeline: Job Plugin

Support for versions older than 2.4 of the Pipeline Job Plugin is deprecated and will be removed.

The concurrentBuild option for Pipeline jobs causes problems (JENKINS-53775). It is deprecated and will be removed. It should be replaced by the disableConcurrentBuilds job property.

DSL prior to 1.76

pipelineJob('example-1') {
    concurrentBuild(false)
}

pipelineJob('example-2') {
    concurrentBuild()
}

DSL since 1.76

pipelineJob('example-1') {
    properties {
        disableConcurrentBuilds()
    }
}

pipelineJob('example-2') {
}

Subversion Plugin

Support for versions older than 2.8 of the Subversion Plugin is deprecated and will be removed.

Migrating to 1.75

The id option in the Git and GitHub branch source contexts is now mandatory (JENKINS-43693).

DSL prior to 1.75

multibranchPipelineJob('example') {
    branchSources {
        github {
        }
    }
}

DSL since 1.75

multibranchPipelineJob('example') {
    branchSources {
        github {
            id('12312313') // IMPORTANT: use a constant and unique identifier
        }
    }
}

Migrating to 1.72

CloudBees Folders Plugin

The periodic trigger is broken (JENKINS-55429) and will be removed. It can be replaced by Dynamic DSL:

DSL prior to 1.72

organizationFolder('example') {
    triggers {
        periodic {
            interval(2)
        }
    }
}

DSL since 1.72

organizationFolder('example') {
    triggers {
        periodicFolderTrigger {
            interval('2m')
        }
    }
}

Migrating to 1.70

The following methods in the pipelineJob are deprecated and will be removed because they are not available for the Pipeline job type.

DSL prior to 1.70

pipelineJob('example') {
    authenticationToken('secret')
    batchTask('upload', 'curl --upload-file build/dist.zip http://www.example.com/upload')
    blockOnUpstreamProjects()
    blockOnDownstreamProjects()
    checkoutRetryCount(10)
    concurrentBuild()
    customWorkspace('/tmp')
    jdk('jdk-1.8')
    label('linux')
    lockableResources('lock-resource')
    multiscm {
         // ...
    }
    publishers {
         // ...
    }
    scm {
         // ...
    }
    steps {
         // ...
    }
    weight(50)
    wrappers {
         // ...
    }
}

Migrating to 1.69

CloudBees Folders Plugin

Support for versions older than 5.14 of the CloudBees Folders Plugin is deprecated and will be removed.

Branch API Plugin

Support for versions older than 2.0.0 of the Branch API Plugin is deprecated and will be removed.

Pipeline Multibranch Plugin

Support for versions older than 2.10 of the Pipeline Multibranch Plugin is deprecated and will be removed.

Perforce Plugin

The Perforce Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

Primary View

Support for setting the primary view in multibranchPipelineJob and organizationFolder is deprecated and will be removed. Setting the primary is not supported by these job types.

Migrating to 1.68

Pipeline Script From SCM

The default script path for Pipeline cpsScm context changed from JenkinsFile to Jenkinsfile as Jenkinsfile is more conventional.

The following example shows how to migrate DSL scripts to keep the old behaviour.

DSL prior to 1.68

pipelineJob('example') {
    definition {
        cpsScm {
            scm {
                git('https://github.com/jenkinsci/job-dsl-plugin.git')
            }
        }
    }
}

DSL since 1.68

pipelineJob('example') {
    definition {
        cpsScm {
            scm {
                git('https://github.com/jenkinsci/job-dsl-plugin.git')
                scriptPath('JenkinsFile')
            }
        }
    }
}

Email Extension Recipient List

The default value of the sendTo recipient list of the Email Extension Plugin has been changed from recipientList() to an empty list.

The following example shows how to migrate DSL scripts to keep the old behaviour.

DSL prior to 1.68

job('example') {
    publishers {
        extendedEmail {
            triggers {
                failure {
                }
            }
        }
    }
}

DSL since 1.68

job('example') {
    publishers {
        extendedEmail {
            triggers {
                failure {
                    sendTo {
                        recipientList()
                    }
                }
            }
        }
    }
}

Gradle Plugin

Support for versions older than 1.28 of the Gradle Plugin is deprecated and will be removed.

When using version 1.27 or later of the Gradle plugin, the generated configuration changed in Job DSL 1.68. The passAsProperties option is deprecated and has been replaced by passAllAsSystemProperties and passAllAsProjectProperties. The following example shows how to migrate DSL scripts to keep the old behaviour.

DSL prior to 1.68

job('example') {
    steps {
        gradle {
            passAsProperties(false)
        }
        gradle {
            passAsProperties(true)
        }
    }
}

DSL since 1.68

job('example') {
    steps {
        gradle {
            passAllAsSystemProperties()
        }
        gradle {
            passAllAsProjectProperties()
        }
    }
}

Pipeline Groovy Plugin

Support for versions older than 2.29 of the Pipeline Groovy Plugin is deprecated and will be removed.

Migrating to 1.67

Groovy Plugin

Support for versions older than 2.0 of the Groovy Plugin is deprecated and will be removed.

Migrating to 1.66

Notification

Support for versions older than 1.12 of the Notification Plugin is deprecated and will be removed.

Cucumber Reports Plugin

Support for the Cucumber Reports Plugin is deprecated and will be removed. Use the syntax provided by the Dynamic DSL instead.

DSL prior to 1.66

job('example') {
    publishers {
        cucumberReports {
            jsonReportPath('files.json')
            pluginUrlPath('url')
            fileIncludePattern('included')
            fileExcludePattern('excluded')
            failOnSkipSteps()
            failOnPendingSteps()
            failOnUndefinedSteps()
            failOnMissingSteps()
            turnOffFlashCharts()
            ignoreFailedTests()
            parallelTesting()
        }
    }
}

DSL since 1.66

job('example') {
    publishers {
        cucumber {
            jsonReportDirectory('build/reports')
            fileIncludePattern('included')
            fileExcludePattern('excluded')
            parallelTesting(false)
            failedFeaturesNumber(12)
            failedScenariosNumber(20)
            failedStepsNumber(5)
            pendingStepsNumber(3)
            skippedStepsNumber(0)
            trendsLimit(7)
            undefinedStepsNumber(8)
        }
    }
}

Migrating to 1.64

HTML Publisher Plugin

Support for versions older than 1.13 of the HTML Publisher Plugin is deprecated and will be removed.

Gradle Plugin

Support for versions older than 1.26 of the Gradle Plugin is deprecated and will be removed.

Migrating to 1.62

Parameterized Remote Trigger Plugin

Support for versions older than 2.0 of the Parameterized Remote Trigger Plugin is deprecated and will be removed.

Build Flow Plugin

The Build Flow Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

Active Choices Plugin

The Active Choices Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

ArtifactDeployer Plugin

The ArtifactDeployer Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

Subversion Tagging Plugin

The Subversion Tagging Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

Grails Plugin

The Grails Plugin has been removed from the Update Center due to Security Vulnerabilities. As a consequence the DSL support is deprecated and will be removed.

Migrating to 1.61

Stash Notifier Plugin

Support for versions older than 1.11.6 of the Stash Notifier Plugin is deprecated and will be removed.

Join Plugin

Support for versions older than 1.21 of the Join Plugin is deprecated and will be removed.

Migrating to 1.60

Script Security

Starting with Job DSL 1.60, script security for Job DSL scripts is enabled by default if Jenkins security is enabled. As a consequence, DSL scripts have either to be approved by an Jenkins administrator or run in an restricted sandbox. To avoid loading arbitrary code from the workspace without approval, the script directory is not added to the classpath and additional classpath entries are not supported when security is enabled. Thus importing classes from the workspace is not possible and the "Additional Classpath" option is not available.

Note that some operators in configure blocks are not available when running in the restricted sandbox.

When using the sandbox, Jenkins access control checks are also applied. For this to work, the DSL job needs to run as a particular user. This is generally accomplished by installing and configuring the Authorize Project plugin.

To restore the old behavior, Job DSL script security can be disabled on the "Configure Global Security" page. But this decision should be taken with care and only if understanding the consequences as it would allow users to run arbitrary code within the Jenkins process (even changing its security settings or running shell commands on the server).

See Script Security for details.

Migrating to 1.59

Mattermost

Support for the Mattermost Plugin is [deprecated|Deprecation-Policy]] and will be removed. Use the syntax provided by the Dynamic DSL instead.

DSL prior to 1.59

job('example') {
    publishers {
        mattermost {
            endpoint(String endpoint)
            showCommitList(boolean showCommitList = true)
            customMessage(String customMessage)
            icon(String icon)
            includeTestSummary(boolean includeTestSummary = true)
            notifyAborted(boolean notifyAborted = true)
            notifyBackToNormal(boolean notifyBackToNormal = true)
            notifyFailure(boolean notifyFailure = true)
            notifyNotBuilt(boolean notifyNotBuilt = true)
            notifyRepeatedFailure(boolean notifyRepeatedFailure = true)
            notifySuccess(boolean notifySuccess = true)
            notifyUnstable(boolean notifyUnstable = true)
            room(String room)
            notifyBuildStart(boolean notifyBuildStart = true)
        }
    }
}

DSL since 1.59

job('example') {
    publishers {
        mattermostNotifier {
            endpoint(String value)
            commitInfoChoice(String value)
            customMessage(String value)
            includeCustomMessage(boolean value)
            icon(String value)
            includeTestSummary(boolean value)
            notifyAborted(boolean value)
            notifyBackToNormal(boolean value)
            notifyFailure(boolean value)
            notifyNotBuilt(boolean value)
            notifyRepeatedFailure(boolean value)
            notifySuccess(boolean value)
            notifyUnstable(boolean value)
            room(String value)
            startNotification(boolean value)
        }
    }
}

Migrating to 1.58

Config Files

The syntax for creating config files is changing to allow new features. The methods customConfigFile, mavenSettingsConfigFile, globalMavenSettingsConfigFile and managedScriptConfigFile are deprecated and will be removed.

Finding config files by name is also deprecated and will be removed. Names must not be unique so lookup by name can yield multiple results. Use the unique config ID instead.

DSL prior to 1.58

customConfigFile('ACME Settings') {
    comment('Settings for ACME tools')
    content(readFileFromWorkspace('acme/settings.json'))
}

mavenSettingsConfigFile('Company Settings') {
    comment('Company Maven Settings')
    content(readFileFromWorkspace('maven/settings.xml'))
    replaceAll()
    serverCredentials('company-A', 'company-A-maven-repository-credentials')
    serverCredentials('company-B', 'company-B-maven-repository-credentials')
}

globalMavenSettingsConfigFile('Company Settings') {
    comment('Company Maven Settings')
    content(readFileFromWorkspace('maven/settings.xml'))
    replaceAll()
    serverCredentials('company-A', 'company-A-maven-repository-credentials')
    serverCredentials('company-B', 'company-B-maven-repository-credentials')
}

managedScriptConfigFile('Example') {
    comment('My script')
    content('echo Hello $1 and $2')
    arguments('NAME_1', 'NAME_2')
}

mavenJob('example-1') {
    providedSettings('Company Settings')
    providedGlobalSettings('Company Settings')
}

job('example-2') {
    wrappers {
        configFiles {
            file('ACME Settings') {
                variable('CONFIG_FILE')
            }
            mavenSettings('Company Settings') {
                targetLocation('settings.xml')
            }
            globalMavenSettings('Company Settings') {
                targetLocation('global-settings.xml')
            }
        }
    }
    steps {
        managedScript('Example') {
            arguments('foo', 'bar')
        }
        maven {
            providedSettings('Company Settings')
            providedGlobalSettings('Company Settings')
        }
    }
}

DSL since 1.58

configFiles {
    customConfig
        id('acme-settings')
        name('ACME Settings') {
        comment('Settings for ACME tools')
        content(readFileFromWorkspace('acme/settings.json'))
    }
    mavenSettingsConfig
        id('company-settings')
        name('Company Settings')
        comment('Company Maven Settings')
        content(readFileFromWorkspace('maven/settings.xml'))
        isReplaceAll(true)
        serverCredentialMappings {
            serverCredentialMapping {
                serverId('company-A')
                credentialsId('company-A-maven-repository-credentials')
            }
        }
        serverCredentialMappings {
            serverCredentialMapping {
                serverId('company-B')
                credentialsId('company-B-maven-repository-credentials')
            }
        }
    }
    globalMavenSettingsConfig {
        id('global-company-settings')
        name('Company Settings') {
        comment('Company Maven Settings')
        content(readFileFromWorkspace('maven/settings.xml'))
        isReplaceAll()
        serverCredentialMappings {
            serverCredentialMapping {
                serverId('company-A')
                credentialsId('company-A-maven-repository-credentials')
            }
        }
        serverCredentialMappings {
            serverCredentialMapping {
                serverId('company-B')
                credentialsId('company-B-maven-repository-credentials')
            }
        }
    }
    scriptConfig {
        id('example')
        name('Example')
        comment('My script')
        content('echo Hello $1 and $2')
        args {
            arg {
                name('NAME_1')
            }
            arg {
                name('NAME_2')
            }
        }
    }
}

mavenJob('example-1') {
    providedSettings('company-settings')
    providedGlobalSettings('global-company-settings')
}

job('example-2') {
    wrappers {
        configFiles {
            file('acme-settings') {
                variable('CONFIG_FILE')
            }
            mavenSettings('company-settings') {
                targetLocation('settings.xml')
            }
            globalMavenSettings('global-company-settings') {
                targetLocation('global-settings.xml')
            }
        }
    }
    steps {
        managedScript('example') {
            arguments('foo', 'bar')
        }
        maven {
            providedSettings('company-settings')
            providedGlobalSettings('global-company-settings')
        }
    }
}

The classes javaposse.jobdsl.dsl.Config, javaposse.jobdsl.dsl.ConfigFile, javaposse.jobdsl.dsl.MavenSettingsConfigFile, javaposse.jobdsl.dsl.ParametrizedConfigFile and javaposse.jobdsl.plugin.ConfigFileProviderHelper as well as the methods createOrUpdateConfigFile and getConfigFileId in javaposse.jobdsl.dsl.JobManagement and it's implementing classes are deprecated and will be removed.

GitLab

Support for versions older than 1.4.0 of the GitLab Plugin is deprecated and will be removed.

Migrating to 1.57

Rbenv

Support for versions older than 0.0.17 of the Rbenv Plugin is deprecated and will be removed.

Migrating to 1.56

SSH Agent

Support for versions older than 1.5 of the SSH Agent Plugin is deprecated and will be removed.

Migrating to 1.55

ScriptRequest

Some constructors and the location property in javaposse.jobdsl.dsl.ScriptRequest are deprecated and will be removed. The body and scriptPath properties should be used instead. The class is part of the internal implementation and should not affect DSL scripts.

Migrating to 1.54

Embedded API Viewer

The short URL for the embedded API Viewer http://localhost:8080/plugin/job-dsl/api-viewer is deprecated and will be removed. Use http://localhost:8080/plugin/job-dsl/api-viewer/index.html instead.

S3

Support for the S3 Plugin is [deprecated|Deprecation-Policy]] and will be removed. Use the syntax provided by the Dynamic DSL instead.

DSL prior to 1.54

job('example') {
    publishers {
        s3('myProfile') {
            entry('foo', 'bar', 'eu-west-1') {
                storageClass('REDUCED_REDUNDANCY')
                noUploadOnFailure()
                uploadFromSlave()
                managedArtifacts()
                useServerSideEncryption()
                flatten()
            }
            metadata('key', 'value')
        }
    }
}

DSL since 1.54

job('example') {
    publishers {
        s3BucketPublisher {
            profileName('myProfile')
            entries {
                entry {
                    bucket('bar')
                    sourceFile('foo')
                    selectedRegion('eu-west-1')
                    storageClass('REDUCED_REDUNDANCY')
                    noUploadOnFailure(true)
                    uploadFromSlave(true)
                    managedArtifacts(true)
                    useServerSideEncryption(true)
                    flatten(true)
                }
            }
            userMetadata {
                metadataPair {
                    key('key')
                    value('value')
                }
            }
        }
    }
}

Delivery Pipeline

Support for versions older than 0.10.0 of the Delivery Pipeline Plugin is deprecated and will be removed.

GitHub Branch Source

Support for versions older than 1.8 of the GitHub Branch Source Plugin is deprecated and will be removed.

JobDslPlugin

The class javaposse.jobdsl.plugin.JobDslPlugin is deprecated and will be removed. It has been deprecated because the constructor of the super class hudson.Plugin has been deprecated. See the documentation of hudson.Plugin for details.

Migrating to 1.53

Overriding Job, Folder or View Names

The ability to override the name of a job, folder or view is deprecated deprecated and will be removed. The name has to be set in the factory method that is creating the job, folder or view.

DSL prior to 1.53

job('example-1') {
    name = 'other-1'
}

folder('example-2') {
    name = 'other-2'
}

listView('example-3') {
    name = 'other-3'
}

DSL since 1.53

job('other-1') {
}

folder('other-2') {
}

listView('other-3') {
}

GitHub Branch Source

The ignoreOnPushNotifications option in the GitHub branch source context is not needed. It has been deprecated and will be removed.

DSL prior to 1.53

multibranchPipelineJob('example') {
    branchSources {
        github {
            ignoreOnPushNotification()
        }
    }
}

DSL since 1.53

multibranchPipelineJob('example') {
    branchSources {
        github {
        }
    }
}

Migrating to 1.52

Git

Support for versions older than 2.5.3 of the Git Plugin is deprecated and will be removed.

Multijob

Support for versions older than 1.22 of the Multijob Plugin is deprecated and will be removed.

Exclusion

Support for versions older than 0.12 of the Exclusion Plugin is deprecated and will be removed.

Rundeck

Support for the RunDeck Plugin is [deprecated|Deprecation-Policy]] and will be removed. Use the syntax provided by the Dynamic DSL instead.

DSL prior to 1.52

job('example') {
    triggers {
        rundeck {
            jobIdentifiers(
                    '2027ce89-7924-4ecf-a963-30090ada834f',
                    'my-project-name:main-group/sub-group/my-job'
            )
            executionStatuses('FAILED', 'ABORTED')
        }
    }
    publishers {
        rundeck('13eba461-179d-40a1-8a08-bafee33fdc12') {
            rundeckInstance('prod')
            options(artifact: 'app', env: 'dev')
            option('version', '1.1')
            tag('#deploy')
            nodeFilters(hostname: 'dev(\\d+).company.net')
            nodeFilter('tags', 'www+dev')
            shouldWaitForRundeckJob()
            shouldFailTheBuild()
            includeRundeckLogs()
        }
    }
}

DSL since 1.52

job('example') {
    triggers {
        rundeckTrigger {
            jobsIdentifiers([
                    '2027ce89-7924-4ecf-a963-30090ada834f',
                    'my-project-name:main-group/sub-group/my-job'
            ])
            executionStatuses(['FAILED', 'ABORTED'])
            filterJobs(true)
        }
    }
    publishers {
        rundeckNotifier {
            jobId('13eba461-179d-40a1-8a08-bafee33fdc12')
            rundeckInstance('prod')
            options(['artifact=app', 'env=dev', 'version=1.1'].join('\n'))
            tags('#deploy')
            nodeFilters(['hostname=dev(\\d+).company.net', 'tags=www+dev'].join('\n'))
            shouldWaitForRundeckJob(true)
            shouldFailTheBuild(true)
            includeRundeckLogs(true)
            tailLog(false)
        }
    }
}

Migrating to 1.51

Rundeck

Support for versions older than 3.5.4 of the RunDeck Plugin is deprecated and will be removed.

RVM

Support for versions older than 0.6 of the RVM Plugin is deprecated and will be removed.

Ruby Runtime

Support for versions older than 0.12 of the Ruby Runtime Plugin is deprecated and will be removed.

Migrating to 1.49

ScriptLocation

The scriptLocation property of javaposse.jobdsl.plugin.ExecuteDslScripts and the javaposse.jobdsl.plugin.ExecuteDslScripts.ScriptLocation class have been deprecated and will be removed. The properties of scriptLocation can now be set directly on ExecuteDslScripts.

Pipeline syntax prior to 1.49

node {
    step([
        $class: 'ExecuteDslScripts',
        scriptLocation: [scriptText: 'job("example-2")'],
    ])
    step([
        $class: 'ExecuteDslScripts',
        scriptLocation: [
            targets: ['jobs/projectA/*.groovy', 'jobs/common.groovy'].join('\n'),
            ignoreMissingFiles: true
        ]
    ])
}

Pipeline syntax since to 1.49

node {
    step([
        $class: 'ExecuteDslScripts',
        scriptText: 'job("example-2")'
    ])
    step([
        $class: 'ExecuteDslScripts',
        targets: ['jobs/projectA/*.groovy', 'jobs/common.groovy'].join('\n'),
        ignoreMissingFiles: true
    ])
}

JobManagement

The return type of the getParameters() method in javaposse.jobdsl.dsl.JobManagement changed from Map<String, String> to Map<String, Object>.

Migrating to 1.48

Pipeline Compatibility

The classes javaposse.jobdsl.plugin.WorkspaceProtocol, javaposse.jobdsl.plugin.WorkspaceUrlConnection and javaposse.jobdsl.plugin.WorkspaceUrlHandler as well as some constructors in javaposse.jobdsl.plugin.JenkinsJobManagement, javaposse.jobdsl.plugin.ExecuteDslScripts and javaposse.jobdsl.plugin.ScriptRequestGenerator are deprecated and will be removed. These classes are part of the internal implementation and should not affect DSL scripts.

The classes javaposse.jobdsl.plugin.actions.GeneratedObjectsBuildAction and javaposse.jobdsl.plugin.actions.GeneratedObjectsBuildRunAction are also deprecated and will be removed. Use javaposse.jobdsl.plugin.actions.GeneratedObjectsRunAction instead.

Migrating to 1.47

Pipeline

The Workflow Plugin has been renamed to Pipeline Plugin. New pipelineJob and multibranchPipelineJob methods have been added as replacements for workflowJob and multibranchWorkflowJob which are deprecated and will be removed.

DSL prior to 1.47

workflowJob('example-1') {
    definition {
        cps {
            script(readFileFromWorkspace('project-a-workflow.groovy'))
            sandbox()
        }
    }
}

multibranchWorkflowJob('example-2') {
    branchSources {
        git {
            remote('https://github.com/jenkinsci/job-dsl-plugin.git')
            credentialsId('github-ci')
            includes('JENKINS-*')
        }
    }
    orphanedItemStrategy {
        discardOldItems {
            numToKeep(20)
        }
    }
}

DSL since 1.47

pipelineJob('example-1') {
    definition {
        cps {
            script(readFileFromWorkspace('project-a-workflow.groovy'))
            sandbox()
        }
    }
}

multibranchPipelineJob('example-2') {
    branchSources {
        git {
            remote('https://github.com/jenkinsci/job-dsl-plugin.git')
            credentialsId('github-ci')
            includes('JENKINS-*')
        }
    }
    orphanedItemStrategy {
        discardOldItems {
            numToKeep(20)
        }
    }
}

GitLab

Support for versions older than 1.2 of the Gitlab Plugin is deprecated and will be removed.

Slack

Support for the Slack Plugin is deprecated because it is incompatible with newer versions of that plugin. It has been replaced by the Dynamic DSL.

DSL prior to 1.47

job('example') {
    publishers {
        slackNotifications {
            projectChannel('Dev Team A')
            notifyAborted()
            notifyFailure()
            notifyNotBuilt()
            notifyUnstable()
            notifyBackToNormal()
        }
    }
}

DSL since 1.47

job('example') {
  publishers {
    slackNotifier {
      room('Dev Team A')
      notifyAborted(true)
      notifyFailure(true)
      notifyNotBuilt(true)
      notifyUnstable(true)
      notifyBackToNormal(true)
      notifySuccess(false)
      notifyRepeatedFailure(false)
      startNotification(false)
      includeTestSummary(false)
      includeCustomMessage(false)
      customMessage(null)
      buildServerUrl(null)
      sendAs(null)
      commitInfoChoice('NONE')
      teamDomain(null)
      authToken(null)
    }
  }
}

HipChat

Support for the HipChat Plugin is deprecated because it is incompatible with newer versions of that plugin. It has been replaced by the Dynamic DSL.

DSL prior to 1.47

job('example') {
    publishers {
        hipChat {
            rooms('Dev Team A', 'QA')
            notifyAborted()
            notifyNotBuilt()
            notifyUnstable()
            notifyFailure()
            notifyBackToNormal()
        }
    }
}

DSL since 1.47

job('example') {
  publishers {
    hipChatNotifier {
      room('Dev Team A, QA')
      matrixTriggerMode('ONLY_PARENT')
      startJobMessage(null)
      completeJobMessage(null)
      token(null)
      notifications {
        notificationConfig {
          notifyEnabled(true)
          textFormat(true)
          notificationType('ABORTED')
          color('GRAY')
          messageTemplate(null)
        }
        notificationConfig {
          notifyEnabled(true)
          textFormat(true)
          notificationType('NOT_BUILT')
          color('GRAY')
          messageTemplate(null)
        }
        notificationConfig {
          notifyEnabled(true)
          textFormat(true)
          notificationType('UNSTABLE')
          color('YELLOW')
          messageTemplate(null)
        }
        notificationConfig {
          notifyEnabled(true)
          textFormat(true)
          notificationType('FAILURE')
          color('RED')
          messageTemplate(null)
        }
        notificationConfig {
          notifyEnabled(true)
          textFormat(true)
          notificationType('BACK_TO_NORMAL')
          color('GREEN')
          messageTemplate(null)
        }
      }
    }
  }
}

Run Condition

The enum javaposse.jobdsl.dsl.helpers.step.condition.FileExistsCondition.BaseDir is deprecated and will be removed. Use javaposse.jobdsl.dsl.helpers.step.RunConditionContext.BaseDir instead.

Migrating to 1.46

MultiJob

The behavior of the currentJobParameters method in the phaseJob context has changed. Prior to 1.46, the method generated a Current build parameters job parameter. Since 1.46 the parameter is not generated when calling currentJobParameters and must be created explicitly.

DSL prior to 1.46

multiJob('example') {
    steps {
        phase('first') {
            phaseJob('job-a') {
                currentJobParameters()
            }
        }
    }
}

DSL since 1.46

multiJob('example') {
    steps {
        phase('first') {
            phaseJob('job-a') {
                currentJobParameters()
                parameters {
                    currentBuild()
                }
            }
        }
    }
}

Migrating to 1.45

Docker Build and Publish

Support for versions older than 1.2 of the CloudBees Docker Build and Publish Plugin is deprecated and will be removed.

DslScriptLoader

The runDslEngine methods in DslScriptLoader are deprecated and will be removed. Use the new runScripts method instead.

EnvInject

Support for the EnvInject Plugin has changed to enable masking passwords and enabling / disabling global passwords injection. Global passwords injection is disabled by default to match the plugin's default configuration.

DSL prior to 1.45

job('example') {
    wrappers {
        injectPasswords()
    }
}

DSL since 1.45

job('example') {
    wrappers {
        injectPasswords {
            injectGlobalPasswords()
        }
    }
}

Priority Sorter

Support for versions older than 3.4 of the Priority Sorter Plugin is deprecated and will be removed. The top-level priority method is deprecated and only supports plugin version prior to 3.0. A new priority method has been added to the properties context which will support plugin versions starting from 3.4.

DSL prior to 1.45

job('example') {
    priority(5)
}

DSL since 1.45

job('example') {
    properties {
        priority(5)
    }
}

Build Node Column

The Build Node Column Plugin is deprecated and has been replaced by the Extra Columns Plugin. DSL support for the Build Node Column Plugin is deprecated as well and will be removed. Use the Extra Columns Plugin instead, the DSL syntax stays the same.

Migrating to 1.44

Git

DSL support for the Git Plugin has been changed to reflect the configuration style of version 2.0 of the Git plugin.

DSL prior to 1.44

job('example') {
    scm {
        git {
            strategy {
                inverse()
            }
            mergeOptions {
                remote('origin')
                branch('feature')
            }
            createTag()
            clean()
            wipeOutWorkspace()
            remotePoll(false)
            shallowClone()
            reference('/git/repo.git')
            cloneTimeout(10)
            recursiveSubmodules()
            trackingSubmodules()
            pruneBranches()
            localBranch('ci')
            relativeTargetDir('ws')
            ignoreNotifyCommit()
        }
    }
}

DSL since 1.44

job('example') {
    scm {
        git {
            extensions {
                choosingStrategy {
                    inverse()
                }
                mergeOptions {
                    remote('origin')
                    branch('feature')
                }
                perBuildTag()
                cleanAfterCheckout()
                wipeOutWorkspace()
                disableRemotePoll()
                cloneOptions {
                    shallow()
                    reference('/git/repo.git')
                    timeout(10)
                }
                submoduleOptions {
                    recursive()
                    tracking()
                }
                pruneBranches()
                localBranch('ci')
                relativeTargetDirectory('ws')
                ignoreNotifyCommit()
            }
        }
    }
}

Lockable Resources

Support for versions older than 1.7 of the Lockable Resources Plugin is deprecated and will be removed.

IRC

Support for versions older than 2.27 of the IRC Plugin is deprecated and will be removed.

JobManagement

The method JobManagement#createOrUpdateConfig(String path, String config, boolean ignoreExisting) has been deprecated since 1.33 and has been removed. Use JobManagement#createOrUpdateConfig(Item item, boolean ignoreExisting) instead.

Moved Classes

The classes javaposse.jobdsl.dsl.helpers.WorkflowDefinitionContext and javaposse.jobdsl.dsl.helpers.CpsContext have been moved to the javaposse.jobdsl.dsl.helpers.workflow package.

WithXmlAction

The class javaposse.jobdsl.dsl.WithXmlAction is deprecated and will be removed. Use javaposse.jobdsl.dsl.ContextHelper#executeConfigureBlock to evaluate a configure block.

Perforce

The method p4(String viewSpec, Closure closure) in the SCM context is deprecated and will be removed.

DSL prior to 1.44

job('example') {
    scm {
        p4('//depot/example/... //workspace/...')
    }
}

DSL since 1.44

job('example') {
    scm {
        p4('//depot/example/... //workspace/...', 'rolem')
    }
}

Migrating to 1.43

Extended Email

The DSL support for the Email-ext Plugin has changed to address several issues.

DSL prior to 1.43

job('example') {
    publishers {
        extendedEmail('me@halfempty.org', 'Oops', 'Something broken') {
            trigger('PreBuild')
            trigger(triggerName: 'StillUnstable', subject: 'Subject', body: 'Body', recipientList: 'RecipientList',
                    sendToDevelopers: true, sendToRequester: true, includeCulprits: true, sendToRecipientList: false)
            configure { node ->
                node / contentType << 'text/html'
            }
        }
    }
}

DSL since 1.43

job('example') {
    publishers {
        extendedEmail {
            recipientList('me@halfempty.org')
            defaultSubject('Oops')
            defaultContent('Something broken')
            contentType('text/html')
            triggers {
                beforeBuild()
                stillUnstable {
                    subject('Subject')
                    content('Body')
                    sendTo {
                        developers()
                        requester()
                        culprits()
                    }
                }
            }
        }
    }
}

GitHub Pull Request Builder

Built-in support for the GitHub Pull Request Builder Plugin is deprecated and will be removed. The GitHub Pull Request Builder Plugin implements the Job DSL extension point and provides it's own Job DSL syntax since version 1.29.7.

DSL prior to 1.43

job('example') {
    triggers {
        pullRequest {
        }
    }
    publishers {
        mergePullRequest {
        }
    }
}

DSL since 1.43

job('example') {
    triggers {
        githubPullRequest {
        }
    }
    publishers {
        mergeGithubPullRequest {
        }
    }
}

Docker Custom Build Environment

Support for versions older than 1.6.2 of the CloudBees Docker Custom Build Environment Plugin is deprecated and will be removed.

Rundeck

Support for versions older than 3.4 of the RunDeck Plugin is deprecated and will be removed.

JUnit

Support for versions older than 1.10 of the JUnit Plugin is deprecated and will be removed.

Notification

Support for versions older than 1.8 of the Notification Plugin is deprecated and will be removed.

JobManagement

Two methods in the JobManagement interface, getPluginVersion and getJenkinsVersion, are deprecated and will be removed to get rid of the org.jenkins-ci:version-number dependency in job-dsl-core. Use isMinimumPluginVersionInstalled as a replacement for getPluginVersion.

API prior to 1.43

if (!jobManagement.getPluginVersion('git')?.isOlderThan(new VersionNumber('2.4.0'))) {
}

API since 1.43

if (jobManagement.isMinimumPluginVersionInstalled('git', '2.4.0')) {
}

ExtensibleContext

The classes ExtensibleContext and AbstractExtensibleContext have been moved from the javaposse.jobdsl.dsl.helpers package to javaposse.jobdsl.dsl. This should not affect DSL scripts.

Migrating to 1.42

Task Scanner

Support for versions older than 4.41 of the Task Scanner Plugin is deprecated and will be removed.

PostBuildScript

Support for versions older than 0.17 of the PostBuildScript Plugin is deprecated and will be removed.

Flexible Publish

The DSL syntax of the flexiblePublish context has been changed to fix (JENKINS-30010).

DSL prior to 1.42

job('example') {
    publishers {
        flexiblePublish {
            condition {
                status('ABORTED', 'FAILURE')
            }
            publisher {
                wsCleanup()
            }
            step {
                shell('echo hello!')
            }
        }
    }
}

DSL since 1.42

job('example') {
    publishers {
        flexiblePublish {
            conditionalAction {
                condition {
                    status('ABORTED', 'FAILURE')
                }
                publishers {
                    wsCleanup()
                }
                steps {
                    shell('echo hello!')
                }
            }
        }
    }
}

Migrating to 1.41

Folders

Support for versions older than 5.0 of the CloudBees Folders Plugin is deprecated and will be removed.

Jabber

Support for versions older than 1.35 of the Jabber Plugin is deprecated and will be removed.

Migrating to 1.40

Gradle

Support for versions older than 1.23 of the Gradle Plugin is deprecated and will be removed.

HTML Publisher

Support for versions older than 1.5 of the HTML Publisher Plugin is deprecated and will be removed.

Migrating to 1.39

MultiJob

A phaseJob method has been added to phase context to fix (JENKINS-27921). The job method within that context has been deprecated and will be removed. The jobName method within the phaseJob context has deprecated and will also be removed.

DSL prior to 1.39

multiJob('example') {
    steps {
        phase('first') {
            job {
                jobName('job-a')
            }
            job('job-b', false, false)
        }
    }
}

DSL since 1.39

multiJob('example') {
    steps {
        phase('first') {
            phaseJob('job-a')
            phaseJob('job-b') {
                currentJobParameters(false)
                exposedScm(false)
            }
        }
    }
}

Subversion

Support for versions older than 2.1 of the Subversion Plugin is deprecated and will be removed.

Parameterized Trigger

Support for versions older than 2.26 of the Parameterized Trigger Plugin is deprecated and will be removed.

JSHint Checkstyle

Support for the JSHint Checkstyle Plugin is deprecated and will be removed. The plugin is no longer available in the Jenkins Update Center.

ConfigFileType

The implicit star import of javaposse.jobdsl.dsl.ConfigFileType in DSL scripts has been removed because the enum is no longer used by any DSL method. If the values are used in scripts nevertheless, they must be used fully qualified or imported explicitly.

DSL prior to 1.39

Custom
MavenSettings

DSL since to 1.39

javaposse.jobdsl.dsl.ConfigFileType.Custom
javaposse.jobdsl.dsl.ConfigFileType.MavenSettings

DslScriptLoader

The signature of DslScriptLoader.runDslEngineForParent has changed and the method is no longer public. The change was necessary to avoid a class loader leak and to fix (JENKINS-30348). Use DslScriptLoader.runDslEngine instead.

Migrating to 1.38

Parameterized Trigger

Support for versions older than 2.25 of the Parameterized Trigger Plugin is deprecated and will be removed.

Some overloaded DSL methods for the Parameterized Trigger Plugin have been replaced by new methods in the nested context. The overloaded methods have been deprecated and will be removed.

DSL prior to 1.38

job('example-1') {
    steps {
        downstreamParameterized {
            trigger('Project1, Project2', 'ALWAYS', false,
                    [buildStepFailure: 'FAILURE',
                     failure         : 'FAILURE',
                     unstable        : 'UNSTABLE'])
        }
    }
}

job('example-2') {
    publishers {
        downstreamParameterized {
            trigger('Project1, Project2', 'UNSTABLE_OR_BETTER', true)
        }
    }
}

DSL since to 1.38

job('example-1') {
    steps {
        downstreamParameterized {
            trigger('Project1, Project2') {
                block {
                    buildStepFailure('FAILURE')
                    failure('FAILURE')
                    unstable('UNSTABLE')
                }
            }
        }
    }
}

job('example-2') {
    publishers {
        downstreamParameterized {
            trigger('Project1, Project2') {
                condition('UNSTABLE_OR_BETTER')
                triggerWithNoParameters()
            }
        }
    }
}

Parameter Passing

The way how parameters are passed to downstream jobs or multi-job phases has changed. The existing methods have been deprecated and will be removed.

DSL prior to 1.38

job('example-1') {
    steps {
        downstreamParameterized {
            trigger('Project1, Project2') {
                predefinedProp('key1', 'value1')
                predefinedProps('key2=value2\nkey3=value3')
            }
        }
    }
}

job('example-2') {
    publishers {
        downstreamParameterized {
            trigger('Project1, Project2') {
                currentBuild()
                sameNode(true)
            }
        }
    }
}

multiJob('example-3') {
    steps {
        phase('test') {
             job('other', false, true) {
                boolParam('cParam', true)
                fileParam('my.properties')
                sameNode()
                matrixParam('it.name=="hello"')
                subversionRevision()
                gitRevision()
                prop('prop1', 'value1')
                nodeLabel('lParam', 'my_nodes')
            }
        }
   }
}

DSL since to 1.38

job('example-1') {
    steps {
        downstreamParameterized {
            trigger('Project1, Project2') {
                parameters {
                    predefinedProp('key1', 'value1')
                    predefinedProps([key2: 'value2', key3: 'value3'])
                }
            }
        }
    }
}

job('example-2') {
    publishers {
        downstreamParameterized {
            trigger('Project1, Project2') {
                parameters {
                    currentBuild()
                    sameNode()
                }
            }
        }
    }
}

multiJob('example-3') {
    steps {
        phase('test') {
            job('other', false, true) {
                parameters {
                    booleanParam('cParam', true)
                    propertiesFile('my.properties')
                    sameNode()
                    matrixSubset('it.name=="hello"')
                    subversionRevision()
                    gitRevision()
                    predefinedProp('prop1', 'value1')
                    nodeLabel('lParam', 'my_nodes')
                }
            }
        }
   }
}

GitHub Pull Request Builder

Support for versions older than 1.26 of the GitHub Pull Request Builder Plugin is deprecated and will be removed.

Migrating to 1.37

Multijob

Support for versions older than 1.16 of the Multijob Plugin is deprecated and will be removed.

Git

Support for versions older than 2.2.6 of the Git Plugin is deprecated and will be removed.

Groovy Postbuild

Support for versions older than 2.2 of the Groovy Postbuild Plugin is deprecated and will be removed.

Migrating to 1.36

Script Names

Groovy currently does not allow to use arbitrary names for scripts, see GROOVY-4020. In the Job DSL plugin, it's currently only working by accident, so usage of arbitrary names is deprecated and will be removed.

In the future only names which contain letters, digits, underscores or dollar signs are allowed, but the name must not start with a digit. Basically these are the rules for Java identifiers, see this and this) for details. The file name extension can be anything and is ignored.

Build Blocker

Support for versions older than 1.7.1 of the Build Blocker Plugin is deprecated and will be removed.

JobManagement

The following method in the JobManagement interface has been deprecated and will be removed along with all implementations:

String getCredentialsId(String credentialsDescription)

Finding credentials by description has been deprecated some time ago, so this method is no longer needed.

AbstractJobManagement

The following methods in AbstractJobManagement have been deprecated and will be removed:

protected static List<StackTraceElement> getStackTrace()

protected static String getSourceDetails(List<StackTraceElement> stackTrace)

protected static String getSourceDetails(String scriptName, int lineNumber)

protected void logWarning(String message, Object... args)

Exception Handling

DSL methods will now throw a javaposse.jobdsl.dsl.DslException instead of java.lang.IllegalArgumentException, java.lang.IllegalStateException or java.lang.NullPointerException when validating arguments.

The javaposse.jobdsl.dsl.DslScriptLoader will also throw a javaposse.jobdsl.dsl.DslException on script errors like compilation failures and missing methods or properties.

Migrating to 1.35

Maven

Support for versions older than 2.3 of the Maven Project Plugin is deprecated and will be removed.

S3

Support for versions 0.6 and earlier of the S3 Plugin is deprecated and will be removed. The region identifiers have changed with version 0.7 of the S3 Plugin.

DSL prior to 1.35

job('example') {
    publishers {
        s3('example') {
            entry('foo', 'bar', 'EU_WEST_1')
        }
    }
}

DSL since to 1.35

job('example') {
    publishers {
        s3('example') {
            entry('foo', 'bar', 'eu-west-1')
        }
    }
}

GitHub Pull Request Builder

Support for versions older than 1.15-0 of the GitHub Pull Request Builder Plugin is deprecated and will be removed.

Conditional Build Steps

Usage build steps directly in the conditionalSteps context is deprecated and will be removed.

DSL prior to 1.35

job('example') {
    steps {
        conditionalSteps {
            condition {
                stringsMatch('${SOME_PARAMETER}', 'pants', false)
            }
            runner('Fail')
            shell("echo 'just one step'")
        }
    }
}

DSL since to 1.35

job('example') {
    steps {
        conditionalSteps {
            condition {
                stringsMatch('${SOME_PARAMETER}', 'pants', false)
            }
            runner('Fail')
            steps {
                shell("echo 'just one step'")
            }
        }
    }
}

Matrix Authorization

Support for versions older than 1.2 of the Matrix Authorization Strategy Plugin is deprecated and will be removed.

Migrating to 1.34

Conditional Build Steps

An undocumented variant of the runner method in conditionalSteps and the EvaluationRunners enum have been deprecated and will be removed.

DSL prior to 1.34

import javaposse.jobdsl.dsl.helpers.step.ConditionalStepsContext

steps {
    conditionalSteps {
        condition {
            alwaysRun()
        }
        runner(ConditionalStepsContext.EvaluationRunners.Fail)
        shell('echo "Hello World!"')
    }
}

DSL since to 1.34

steps {
    conditionalSteps {
        condition {
            alwaysRun()
        }
        runner('Fail')
        shell('echo "Hello World!"')
    }
}

Migrating to 1.33

Archive Artifacts

The latestOnly option is deprecated in newer versions of Jenkins and therefore it's also deprecated in the DSL and will be removed. Use logRotator to configure which artifacts to keep.

DSL prior to 1.33

job('example-1') {
    publishers {
        archiveArtifacts('*.xml', null, true)
    }
}

job('example-2') {
    publishers {
        archiveArtifacts {
            pattern('*.xml')
            latestOnly()
        }
    }
}

DSL since 1.33

job('example-1') {
    logRotator(-1, -1, -1, 1)
    publishers {
        archiveArtifacts('*.xml')
    }
}

job('example-2') {
    logRotator(-1, -1, -1, 1)
    publishers {
        archiveArtifacts {
            pattern('*.xml')
        }
    }
}

Copy Artifacts

Support for versions 1.30 and earlier of the Copy Artifact Plugin is deprecated and will be removed.

All variants of copyArtifacts with more than two parameters have been replaced by a nested context and are deprecated.

DSL prior to 1.33

job('example') {
    steps {
        copyArtifacts('other-1', '*.xml') {
            latestSaved()
        }
        copyArtifacts('other-2', '*.txt', 'files') {
            buildNumber(5)
        }
        copyArtifacts('other-3', '*.csv', 'target', true) {
            latestSuccessful(true)
        }
        copyArtifacts('other-4', 'build/*.jar', 'libs', true, true) {
            upstreamBuild()
        }
    }
}

DSL since 1.33

job('example') {
    steps {
        copyArtifacts('other-1') {
            includePatterns('*.xml')
            buildSelector {
                latestSaved()
            }
        }
        copyArtifacts('other-2') {
            includePatterns('*.txt')
            targetDirectory('files')
            buildSelector {
                buildNumber(5)
            }
        }
        copyArtifacts('other-3') {
            includePatterns('*.csv')
            targetDirectory('target')
            flatten()
            buildSelector {
                latestSuccessful(true)
            }
        }
        copyArtifacts('other-4') {
            includePatterns('build/*.jar')
            targetDirectory('libs')
            flatten()
            optional()
            buildSelector {
                upstreamBuild()
            }
        }
    }
}

Robot Framework

Support for versions older than 1.4.3 of the Robot Framework Plugin is deprecated and will be removed.

Mercurial

Support for versions older than 1.50.1 of the Mercurial Plugin is deprecated and will be removed.

Flexible Publish

Support for versions older than 0.13 of the Flexible Publish Plugin is deprecated and will be removed.

Migrating to 1.31

Nested Views

The views closure of the nested view type has been changed to use the same method signatures than the top-level factory methods.

DSL prior to 1.31

nestedView('project-a') {
    views {
        view('overview') {
        }
        view('pipeline', type: BuildPipelineView) {
        }
    }
}

DSL since 1.31

nestedView('project-a') {
    views {
        listView('overview') {
        }
        buildPipelineView('pipeline') {
        }
    }
}

MultiJob Plugin

Support for version 1.12 and earlier of the MultiJob Plugin is deprecated and will be removed.

Local Maven Repository Location

The localRepository method with a javaposse.jobdsl.dsl.helpers.common.MavenContext.LocalRepositoryLocation argument has been deprecated and replaced by a method with a javaposse.jobdsl.dsl.helpers.LocalRepositoryLocation argument. The values of the enum have been renamed from camel case to upper case to follow the naming convention for enum values. The new enum is implicitly imported, but not with star import as the new deprecated variant.

DSL prior to 1.31

mavenJob {
    localRepository(LocalToWorkspace)
}
job {
    steps {
        maven {
            localRepository(LocalToWorkspace)
        }
    }
}

DSL since 1.31

mavenJob {
    localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
}
job {
    steps {
        maven {
            localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
        }
    }
}

Permissions

The Permissions enum has been deprecated because it can not reflect all permissions that are available at runtime.

DSL prior to 1.31

job {
    permission(Permissions.ItemRead, 'jill')
    permission('RunUpdate', 'joe')
}

DSL since 1.31

job {
    authorization {
        permission('hudson.model.Item.Read', 'jill')
        permission('hudson.model.Run.Update', 'joe')
    }
}

Migrating to 1.30

Factory and Name Methods

The generic factory methods job, view and configFile have been deprecated and replaced by concrete ones. The name methods have also been deprecated. The name must be specified as argument to the factory methods.

DSL prior to 1.30

job {
    name('one')
}
job(type: Maven) {
    name('two')
}
folder {
    name('three')
}
view {
    name('four')
}
view(type: NestedView) {
    name('five')
}
configFile {
    name('six')
}
configFile(type: MavenSettings) {
    name('seven')
}

DSL since 1.30

freeStyleJob('one') {
}
mavenJob('two') {
}
folder('three') {
}
listView('four') {
}
nestedView('five') {
}
customConfigFile('six') {
}
mavenSettingsConfigFile('seven') {
}

Jabber Publisher

The publishJabber DSL methods with strategyName and channelNotificationName have been deprecated. Use the methods of the context instead.

DSL prior to 1.30

job {
    publishers {
        publishJabber('one@example.org', 'ANY_FAILURE')
        publishJabber('two@example.org', 'STATECHANGE_ONLY', 'BuildParameters')
    }
}

DSL since 1.30

job {
    publishers {
        publishJabber('one@example.org') {
            strategyName('ANY_FAILURE')
        }
        publishJabber('two@example.org') {
            strategyName('STATECHANGE_ONLY')
            channelNotificationName('BuildParameters')
        }
    }
}

Finding Credentials by Description

Finding credentials by description has been deprecated. The argument passed to the credentials methods (e.g. for Git or Subversion SCM) has been used to find credentials by comparing the value to the credential's description and ID. Using the description can cause problems because it's not enforced that descriptions are unique. But it was useful because the ID was a generated UUID that could not be changed and thus was neither portable between Jenkins instances nor readable in scripts as a symbolic name would be. Since version 1.21, the credentials plugin supports to set the ID to any unique value when creating new credentials. So it's no longer necessary to use the description for matching.

DSL prior to 1.30

job {
    scm {
        git {
            remote {
                github('account/repo')
                credentials('GitHub CI Key')
            }
        }
    }
}

DSL since 1.30

job {
    scm {
        git {
            remote {
                github('account/repo')
                credentials('github-ci-key')
            }
        }
    }
}

Build Timeout

The javaposse.jobdsl.dsl.helpers.wrapper.WrapperContext.Timeout enum has been deprecated because it's not used by the DSL anymore.

The failBuild option with a boolean argument has been deprecated.

DSL prior to 1.30

job {
    wrappers {
        buildTimeout() {
            failBuild(true)
        }
    }
}

DSL since 1.30

job {
    wrappers {
        buildTimeout() {
            failBuild()
        }
    }
}

Migrating to 1.29

Grab Support

Support for the @Grab and @Grapes annotation has been deprecated and replaced by the Additional classpath option of the Process Job DSLs build step.

DSL prior to 1.29

@Grab(group='commons-lang', module='commons-lang', version='2.4')

import org.apache.commons.lang.WordUtils

println "Hello ${WordUtils.capitalize('world')}"

DSL since 1.29

import org.apache.commons.lang.WordUtils

println "Hello ${WordUtils.capitalize('world')}"

But to be able to use a library, it has to be added to the Additional classpath option of the Process Job DSLs build step (e.g. lib/commons-lang-2.4.jar or lib/*.jar) and the JAR files have to be in workspace of the seed job (e.g. in a lib directory). See Using Libraries for details.

Per Module Email

The perModuleEmail option has been deprecated because the e-mail notification settings have changed in newer versions of the Maven Project Plugin, see JENKINS-26284.

DSL prior to 1.29

job(type: Maven) {
    perModuleEmail(true)
}

DSL since 1.29

job(type: Maven) {
    configure {
        it / reporters << 'hudson.maven.reporters.MavenMailer' {
            recipients()
            dontNotifyEveryUnstableBuild(false)
            sendToIndividuals(false)
            perModuleEmail(true)
        }
    }
}

Migrating to 1.28

HTML Publisher

The non-closure variants of the report methods in the publishHtml context have been deprecated in favor of a new closure variant.

DSL prior to 1.28

job {
    publishers {
        publishHtml {
            report('build', 'Report Name', 'content.html', true)
            report(reportName: 'Report Name', reportDir: 'build', reportFiles: 'content.html', keepAll: true)
        }
    }
}

DSL since 1.28

job {
    publishers {
        publishHtml {
            report('build') {
                reportName('Report Name')
                reportFiles('content.html')
                keepAll()
            }
        }
    }
}

DSL Method Return Values

Prior to version 1.28 most DSL methods had an undocumented return value. Since 1.28 DSL methods do not return a value except for the methods defined in javaposse.jobdsl.dsl.DslFactory.

Context and ContextHelper

The Context interface and the ContextHelper class have been moved from package javaposse.jobdsl.dsl.helpers to package javaposse.jobdsl.dsl.

Migrating to 1.27

Job Name

The name method variant with a closure parameter in the job closure is deprecated, use the string argument variant instead.

DSL prior to 1.27

job {
    name {
        'foo'
    }
}

DSL since 1.27

job {
    name('foo')
}

Permissions

In version 1.27 undocumented permission methods in the job context have been deprecated. Use the authorization context instead.

DSL prior to 1.27

job {
    permission('hudson.model.Item.Configure:jill')
    permission(Permissions.ItemRead, 'jack')
    permission('RunUpdate', 'joe')
}

DSL since 1.27

job {
    authorization {
        permission('hudson.model.Item.Configure:jill')
        permission(Permissions.ItemRead, 'jack')
        permission('RunUpdate', 'joe')
    }
}

Migrating to 1.26

Archive JUnit Report

In version 1.26 the archiveJunit method with boolean arguments has been deprecated and has been replaced by a closure variant.

DSL prior to 1.26

job {
    publishers {
        archiveJunit('**/target/surefire-reports/*.xml', true, true, true)
    }
}

DSL since 1.26

job {
    publishers {
        archiveJunit('**/target/surefire-reports/*.xml') {
            retainLongStdout()
            testDataPublishers {
                allowClaimingOfFailedTests()
                publishTestAttachments()
            }
        }
    }
}

See the API Viewer for further details.

Xvnc

In version 1.26 the xvnc method with one boolean argument has been deprecated and has been replaced by a closure variant.

DSL prior to 1.26

job {
    wrappers {
        xvnc(true)
    }
}

DSL since 1.26

job {
    wrappers {
        xvnc {
            takeScreenshot()
        }
    }
}

See the API Viewer for further details.

Gerrit Trigger

The usage "short names" in the event closure is deprecated and has been replaced by explicit DSL methods for each event.

DSL prior to 1.26

job {
    triggers {
        gerrit {
            events {
                ChangeAbandoned
                ChangeMerged
                ChangeRestored
                CommentAdded
                DraftPublished
                PatchsetCreated
                RefUpdated
            }
        }
    }
}

DSL since 1.26

job {
    triggers {
        gerrit {
            events {
                changeAbandoned()
                changeMerged()
                changeRestored()
                commentAdded()
                draftPublished()
                patchsetCreated()
                refUpdated()
            }
        }
    }
}

See the API Viewer for further details.

AbstractStepContext

javaposse.jobdsl.dsl.helpers.step.AbstractStepContext has been removed, use javaposse.jobdsl.dsl.helpers.step.StepContext instead.

DSL prior to 1.26

AbstractStepContext.metaClass.myStep = { ... }

DSL since 1.26

StepContext.metaClass.myStep = { ... }

Migrating to 1.24

Build Timeout

In version 1.24 the dsl for the build timeout plugin has been modified and the generated xml requires a newer version of the build timeout plugin. The old dsl still works but has been deprecated.

DSL prior to 1.24

timeout(String type) { //type is one of: 'absolute', 'elastic', 'likelyStuck'
    limit 15       // timeout in minutes
    percentage 200 // percentage of runtime to consider a build timed out
}

timeout(35, false)

DSL since 1.24

timeout {
   absolute(15)
   failBuild()
   writeDescription('Build failed due to timeout after {0} minutes')
}

timeout {
    absolute(35)
    failBuild(false)
}

See the API Viewer for further details.

Gerrit Trigger

Before 1.24, the Gerrit trigger configuration used hardwired configuration for unset label configurations (successfulVerified +1, failedVerified -1, everything else 0, these are the default values of the central Gerrit trigger plugin configuration). Now the Gerrit trigger configuration correctly honors central configuration of labels. If you use non-default labels in your central configuration, you might need to change the trigger label configuration of your jobs.

See the API Viewer for further details.

Migrating to 1.20

In version 1.20, some implementation classes have been moved to work around a bug in Groovy. When these classes have been used to extend the DSL, import statements and fully qualified class names have to be adjusted.

Migrating to 1.19

In version 1.19 all build wrapper elements have been moved from the job element to a wrappers sub-element. When upgrading to 1.19 or later, the wrapper elements have to moved as shown below.

DSL prior to 1.19:

job {
    ...
    runOnSameNodeAs 'other', true
    rvm 'ruby-1.9.2-p290'
    timeout 60
    allocatePorts('PORT_A', 'PORT_B')
    sshAgent 'deploy-key'
    ...
}

DSL since 1.19:

job {
    ...
    wrappers {
        runOnSameNodeAs 'other', true
        rvm 'ruby-1.9.2-p290'
        timeout 60
        allocatePorts('PORT_A', 'PORT_B')
        sshAgent 'deploy-key'
    }
    ...
}
Clone this wiki locally