Skip to content

Commit

Permalink
Merge pull request #16103 from AdamBrousseau/prepend_arty_buildname
Browse files Browse the repository at this point in the history
Jenkins: Add option to prefix Artifactory build names
  • Loading branch information
keithc-ca authored Oct 16, 2023
2 parents 720a42a + b5cf282 commit d5a2e02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion buildenv/jenkins/common/build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,16 @@ def upload_artifactory_core(geo, uploadSpec) {
// Add BUILD_IDENTIFIER to the buildInfo. The UploadSpec adds it to the Artifact info
buildInfo.env.filter.addInclude("BUILD_IDENTIFIER")
buildInfo.env.capture = true
if (ARTIFACTORY_CONFIG[geo]['buildNamePrefix'] != '') {
buildInfo.name = ARTIFACTORY_CONFIG[geo]['buildNamePrefix'] + '/' + JOB_NAME
}
println "buildInfo.name:$buildInfo.name"

//Retry uploading to Artifactory if errors occur
// Do not upload buildInfo if Server is behind a VPN as the Controller will not be able to talk to it.
pipelineFunctions.retry_and_delay({
server.upload spec: uploadSpec, buildInfo: buildInfo;
if ("${ARTIFACTORY_CONFIG[geo]['vpn']}" == "false") { server.publishBuildInfo buildInfo } },
server.publishBuildInfo buildInfo},
3, 300)

ARTIFACTORY_CONFIG[geo]['url'] = server.getUrl()
Expand Down
1 change: 1 addition & 0 deletions buildenv/jenkins/common/variables-functions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ def set_basic_artifactory_config(id="Nightly") {
ARTIFACTORY_CONFIG[geo]['daysToKeepArtifacts'] = get_value(VARIABLES.artifactory.daysToKeepArtifacts, geo).toInteger()
ARTIFACTORY_CONFIG[geo]['manualCleanup'] = get_value(VARIABLES.artifactory.manualCleanup, geo)
ARTIFACTORY_CONFIG[geo]['vpn'] = get_value(VARIABLES.artifactory.vpn, geo)
ARTIFACTORY_CONFIG[geo]['buildNamePrefix'] = get_value(VARIABLES.artifactory.buildNamePrefix, geo)
}

/*
Expand Down
3 changes: 3 additions & 0 deletions buildenv/jenkins/variables/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ artifactory:
default: 'ci-openj9'
uploadDir:
default: "${repo}/${JOB_NAME}/${BUILD_ID}"
buildNamePrefix:
osu: ''
unb: ''
daysToKeepArtifacts:
osu: 40
unb: 30
Expand Down

0 comments on commit d5a2e02

Please sign in to comment.