From 9d36f7e18270cedbc0f5ce5ea1fad5831099be5b Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Thu, 21 Aug 2025 15:44:00 -0500 Subject: [PATCH] Adjusted Jenkinsfile DOCS_BRANCH for ssh publisher to get dynamically when it is needed Ticket: ENT-12581 Changelog: none --- Jenkinsfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 259c5d7d3..551dad4e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,6 +3,7 @@ pipeline { environment { REPOS = "core enterprise nova masterfiles northerntechhq/nt-docs" PR_BASE = getPR_BASE() + DOCS_BRANCH = getDOCS_BRANCH() PACKAGE_JOB = "cf-remote" PACKAGE_UPLOAD_DIRECTORY = "n/a" PACKAGE_BUILD = "n/a" @@ -14,7 +15,7 @@ pipeline { 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.') 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.') 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.') - 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/') + 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/') 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') 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/') } @@ -110,7 +111,7 @@ mv upload/* output makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', - remoteDirectory: 'upload/$BUILD_TAG/build-documentation-$DOCS_BRANCH/$BUILD_TAG/', + remoteDirectory: getRemoteDirectory(), remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'output/' @@ -127,7 +128,9 @@ mv upload/* output } // stages } def getDOCS_BRANCH() { - if (env.CHANGE_ID) { + if (env.DOCS_BRANCH) { + return env.DOCS_BRANCH + } else if (env.CHANGE_ID) { return "${env.CHANGE_TARGET}" } else { return "${env.BRANCH_NAME}" @@ -140,3 +143,6 @@ def getPR_BASE() { return "" } } +def getRemoteDirectory() { + return "upload/${env.BUILD_TAG}/build-documentation-${env.DOCS_BRANCH}/${env.BUILD_TAG}/" +}