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
romangurevitch
committed
Aug 7, 2016
1 parent
5fa140f
commit 4a03668
Showing
14 changed files
with
93 additions
and
31 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
node { | ||
git url: 'https://github.com/jfrogdev/project-examples.git' | ||
def filePathPrefix = 'jenkins-pipeline-examples/aql-example/' | ||
|
||
// Get Artifactory server instance, defined in the Artifactory Plugin administration page. | ||
def server = Artifactory.server SERVER_ID | ||
|
||
def buildInfo = Artifactory.newBuildInfo() | ||
// You can set the build name and number. | ||
// Set custom build name and number. | ||
buildInfo.setName 'holyFrog' | ||
buildInfo.setNumber '42' | ||
|
||
// Read the upload spec which was downloaded from github. | ||
def uploadSpec = readFile "${filePathPrefix}upload.json" | ||
def uploadSpec = readFile 'jenkins-pipeline-examples/resources/recursive-flat-upload.json' | ||
// Upload to Artifactory. | ||
server.upload uploadSpec, buildInfo | ||
server.upload spec: uploadSpec, buildInfo: buildInfo | ||
|
||
// The download file contains pattern for downloading artifacts to the root directory by setting recursive=false | ||
def downloadSpec = readFile "${filePathPrefix}download.json" | ||
server.download downloadSpec, buildInfo | ||
def downloadSpec = readFile 'jenkins-pipeline-examples/resources/aql-download.json' | ||
server.download spec: downloadSpec, buildInfo: buildInfo | ||
|
||
// Publish build info. | ||
server.publishBuildInfo buildInfo | ||
} |
40 changes: 40 additions & 0 deletions
40
jenkins-pipeline-examples/build-promotion-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,40 @@ | ||
node { | ||
stage 'Build' | ||
git url: 'https://github.com/jfrogdev/project-examples.git' | ||
|
||
// Get Artifactory server instance, defined in the Artifactory Plugin administration page. | ||
def server = Artifactory.server SERVER_ID | ||
|
||
// Create the upload spec. | ||
def uploadSpec = readFile 'jenkins-pipeline-examples/resources/props-upload.json' | ||
|
||
// Upload to Artifactory. | ||
def buildInfo = server.upload spec: uploadSpec | ||
|
||
// Create the download spec. | ||
def downloadSpec = readFile 'jenkins-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' | ||
def promotionConfig = [ | ||
//Mandatory parameters | ||
'buildName' : buildInfo.name, | ||
'buildNumber' : buildInfo.number, | ||
'targetRepo' : 'libs-release-local', | ||
|
||
//Optional parameters | ||
'comment' : 'this is the promotion comment', | ||
'sourceRepo' : 'libs-snapshot-local', | ||
'status' : 'Released', | ||
'includeDependencies': true, | ||
'copy' : true | ||
] | ||
|
||
// Promote build | ||
server.promote promotionConfig | ||
} |
23 changes: 23 additions & 0 deletions
23
jenkins-pipeline-examples/buildinfo-vars-retention-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,23 @@ | ||
node { | ||
def server = Artifactory.server SERVER_ID | ||
def buildInfo = Artifactory.newBuildInfo() | ||
|
||
stage 'Collect env vars' | ||
// By default the filter is configured to exclude "*password*,*secret*,*key*" | ||
buildInfo.env.filter.addInclude("*") | ||
buildInfo.env.filter.addExclude("DONT_COLLECT*") | ||
|
||
withEnv(['DO_COLLECT_FOO=BAR', 'DONT_COLLECT_FOO=BAR']) { | ||
buildInfo.env.collect() | ||
} | ||
|
||
stage 'Access build info env vars' | ||
echo buildInfo.env.vars['DO_COLLECT_FOO'] //BAR | ||
echo buildInfo.env.vars['DONT_COLLECT_FOO'] //null | ||
|
||
stage 'Set build retention' | ||
buildInfo.retention maxBuilds: 1, maxDays: 2, doNotDiscardBuilds: ["3"], deleteBuildArtifacts: true | ||
|
||
stage 'Publish buildInfo' | ||
server.publishBuildInfo buildInfo | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,13 @@ | ||
{ | ||
"files": [ | ||
{ | ||
"pattern": "jenkins-pipeline-examples/resources/ArtifactoryPipeline.zip", | ||
"target": "libs-snapshot-local", | ||
"props": "p1=v1;p2=v2" | ||
}, | ||
{ | ||
"pattern": "jenkins-pipeline-examples/resources/ArtifactoryPipelineNoProps.zip", | ||
"target": "libs-snapshot-local" | ||
} | ||
] | ||
} |
4 changes: 2 additions & 2 deletions
4
...pipeline-examples/aql-example/upload.json → ...ples/resources/recursive-flat-upload.json
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
File renamed without changes.
File renamed without changes.