node { def server def uploadSpec def buildInfo def downloadSpec def promotionConfig stage ('Build') { git url: 'https://github.com/jfrog/project-examples.git' // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: server = Artifactory.server SERVER_ID // Create the upload spec. uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' // Upload to Artifactory. buildInfo = server.upload spec: uploadSpec // Create the download spec. downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-download.json' // Download from Artifactory. server.download spec: downloadSpec, buildInfo: buildInfo // Publish the build to Artifactory server.publishBuildInfo buildInfo } stage ('Promotion') { promotionConfig = [ //Mandatory parameters 'buildName' : buildInfo.name, 'buildNumber' : buildInfo.number, 'targetRepo' : ARTIFACTORY_LOCAL_RELEASE_REPO, //Optional parameters 'comment' : 'this is the promotion comment', 'sourceRepo' : ARTIFACTORY_LOCAL_SNAPSHOT_REPO, 'status' : 'Released', 'includeDependencies': true, 'failFast' : true, 'copy' : true ] // Promote build server.promote promotionConfig } }