Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
jenkins-pipeline-examples/props-single-file-example/Jenkinsfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
node { | ||
git url: 'https://github.com/jfrogdev/project-examples.git' | ||
def filePathPrefix = 'jenkins-pipeline-examples/props-example/' | ||
|
||
// Get Artifactory server instance, defined in the Artifactory Plugin administration page. | ||
def server = Artifactory.server SERVER_ID | ||
|
||
// Create the upload spec. | ||
def uploadSpec = """{ | ||
"files": [ | ||
{ | ||
"pattern": "jenkins-pipeline-examples/files/ArtifactoryPipeline.zip", | ||
"target": "libs-snapshot-local", | ||
"props": "p1=v1;p2=v2" | ||
}, | ||
{ | ||
"pattern": "jenkins-pipeline-examples/files/ArtifactoryPipelineNoProps.zip", | ||
"target": "libs-snapshot-local" | ||
} | ||
] | ||
}""" | ||
|
||
// Upload to Artifactory. | ||
def buildInfo1 = server.upload uploadSpec | ||
|
||
// Create the download spec. | ||
def downloadSpec = """{ | ||
"files": [ | ||
{ | ||
"pattern": "libs-snapshot-local/*(Pipeline).zip", | ||
"target": "Bazinga/{1}/", | ||
"props": "p1=v1;p2=v2" | ||
} | ||
] | ||
}""" | ||
|
||
// Download from Artifactory. | ||
def buildInfo2 = server.download downloadSpec | ||
|
||
// Merge the upload and download build-info objects. | ||
buildInfo1.append buildInfo2 | ||
|
||
// Publish the build to Artifactory | ||
server.publishBuildInfo buildInfo1 | ||
} |