Skip to content

Commit 210493d

Browse files
Merge pull request #3492 from craigcomstock/ENT-12581-fix-docs-branch-value
Adjusted Jenkinsfile DOCS_BRANCH for ssh publisher to get dynamically when it is needed
2 parents 399cfed + 9d36f7e commit 210493d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

Jenkinsfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pipeline {
33
environment {
44
REPOS = "core enterprise nova masterfiles northerntechhq/nt-docs"
55
PR_BASE = getPR_BASE()
6+
DOCS_BRANCH = getDOCS_BRANCH()
67
PACKAGE_JOB = "cf-remote"
78
PACKAGE_UPLOAD_DIRECTORY = "n/a"
89
PACKAGE_BUILD = "n/a"
@@ -14,7 +15,7 @@ pipeline {
1415
string(name: "MASTERFILES_REV", defaultValue: '', description: 'used to document masterfiles. Use NUMBER or "pull/NUMBER/merge" for pull request (it\'s merged version, THIS DOESN\'T MERGE THE PR) or "pull/NUMBER/head" to build the docs with the non-merged code. Special syntax \'tag:SOME_TAG\' can be used to use a tag as a revision.')
1516
string(name: "DOCS_REV", defaultValue: '', description: 'Use NUMBER or "pull/NUMBER/merge" for pull request (it\'s merged version, THIS DOESN\'T MERGE THE PR) or "pull/NUMBER/head" to build the docs with the non-merged code. Special syntax \'tag:SOME_TAG\' can be used to use a tag as a revision.')
1617
string(name: "NT_DOCS_REV", defaultValue: '', description: 'Use NUMBER or "pull/NUMBER/merge" for pull request (it\'s merged version, THIS DOESN\'T MERGE THE PR) or "pull/NUMBER/head" to build the docs with the non-merged code. Special syntax \'tag:SOME_TAG\' can be used to use a tag as a revision.')
17-
string(name: "DOCS_BRANCH", defaultValue: getDOCS_BRANCH(), description: 'Where to upload artifacts - to http://buildcache.cloud.cfengine.com/packages/build-documentation-$DOCS_BRANCH/ and https://docs.cfengine.com/docs/$DOCS_BRANCH/')
18+
string(name: "DOCS_BRANCH", defaultValue: '', description: 'Where to upload artifacts - to http://buildcache.cloud.cfengine.com/packages/build-documentation-$DOCS_BRANCH/ and https://docs.cfengine.com/docs/$DOCS_BRANCH/')
1819
string(name: "PACKAGE_JOB", defaultValue: 'cf-remote', description: 'where to get CFEngine HUB package from, either a dir at http://buildcache.cloud.cfengine.com/packages like testing-pr or a keyword cf-remote to use cf-remote download')
1920
string(name: "USE_NIGHTLIES_FOR", defaultValue: '', description: 'branch whose nightlies to use (master, 3.18.x, etc) - will be one of http://buildcache.cloud.cfengine.com/packages/testing-pr/jenkins-$USE_NIGHTLIES_FOR-nightly-pipeline-$NUMBER/')
2021
}
@@ -110,7 +111,7 @@ mv upload/* output
110111
makeEmptyDirs: false,
111112
noDefaultExcludes: false,
112113
patternSeparator: '[, ]+',
113-
remoteDirectory: 'upload/$BUILD_TAG/build-documentation-$DOCS_BRANCH/$BUILD_TAG/',
114+
remoteDirectory: getRemoteDirectory(),
114115
remoteDirectorySDF: false,
115116
removePrefix: '',
116117
sourceFiles: 'output/'
@@ -127,7 +128,9 @@ mv upload/* output
127128
} // stages
128129
}
129130
def getDOCS_BRANCH() {
130-
if (env.CHANGE_ID) {
131+
if (env.DOCS_BRANCH) {
132+
return env.DOCS_BRANCH
133+
} else if (env.CHANGE_ID) {
131134
return "${env.CHANGE_TARGET}"
132135
} else {
133136
return "${env.BRANCH_NAME}"
@@ -140,3 +143,6 @@ def getPR_BASE() {
140143
return ""
141144
}
142145
}
146+
def getRemoteDirectory() {
147+
return "upload/${env.BUILD_TAG}/build-documentation-${env.DOCS_BRANCH}/${env.BUILD_TAG}/"
148+
}

0 commit comments

Comments
 (0)