diff --git a/Jenkinsfile_Common b/Jenkinsfile_Common index 2a57f1e..92d48f0 100644 --- a/Jenkinsfile_Common +++ b/Jenkinsfile_Common @@ -40,7 +40,7 @@ def isRelease(versionParam) { def handleSubmodules(versionParam) { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { println "init submodules..." sh 'git submodule update --init' if(isRelease(versionParam)) { @@ -113,7 +113,7 @@ def buildVersionString(imageType, actualBaseVersionString, versionParameter) { } def getVersionString(versionParam, imageType) { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { sh 'git fetch -ap' sh 'git fetch -t' } diff --git a/Jenkinsfile_RamdiskImages b/Jenkinsfile_RamdiskImages index ede127b..541be5d 100644 --- a/Jenkinsfile_RamdiskImages +++ b/Jenkinsfile_RamdiskImages @@ -16,7 +16,7 @@ pipeline { choice(name: 'MACHINE', choices: ['select...', 'am335x-nrhw20', 'am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform') choice(name: 'IMAGE_TYPE', choices: ['lava', 'fct', 'minimal'], description: 'choose image type') string(name: 'RLS_VERSION', defaultValue: '', description: 'Set the version to build and use committed submodules') - string(name: 'NODE_NAME', defaultValue: 'oem-ci', description: 'Overwrite default node name to build on') + string(name: 'NODE_NAME', defaultValue: 'lxbuild3', description: 'Overwrite default node name to build on') booleanParam(name: 'CLEAN_BUILD', defaultValue: false, description: 'clean all temp directories before build starts') } @@ -49,6 +49,19 @@ pipeline { // correct build directory env.BUILD_DIR_POSTFIX = "${params.IMAGE_TYPE}" == "lava" ? "-fct" : "-${params.IMAGE_TYPE}" + // take the correct user ID for the ssh connection of + // the belonging build server + if("${params.NODE_NAME}" == "lxbuild4") { + env.SSH_ID = '6b90ac7f-9596-4e43-923b-6c9179a10d8a' + } + else if("${params.NODE_NAME}" == "lxbuild3") { + env.SSH_ID = '70c27394-cb7d-4304-aed1-89e15a3a78d0' + } + else { + env.SSH_ID = '' + } + println "SSH_ID used: ${env.SSH_ID}" + // load yocto common file env.ROOTDIR = pwd() yoctocommon = load "${env.ROOTDIR}/Jenkinsfile_Common" @@ -130,7 +143,7 @@ def printJobParameters() { def build(envType, imgType) { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { def envPostFix = "${envType}" == "" ? "" : "-${envType}" sh "bash -c '. ./env.image${envPostFix} > /dev/null && bitbake -q -k virtual/netmodule-image'" } diff --git a/Jenkinsfile_mmcImages b/Jenkinsfile_mmcImages index 8cc8b63..4061fb9 100644 --- a/Jenkinsfile_mmcImages +++ b/Jenkinsfile_mmcImages @@ -16,7 +16,7 @@ pipeline { choice(name: 'MACHINE', choices: ['select...', 'am335x-nrhw20', 'am335x-nmhw21', 'imx8-nmhw23', 'am335x-nmhw24', 'am335x-hw25', 'am335x-hw26'], description: 'choose target platform') choice(name: 'IMAGE_TYPE', choices: ['dev', 'bootloader', 'release'], description: 'choose image type') string(name: 'RLS_VERSION', defaultValue: '', description: 'Set the version to build and use committed submodules') - string(name: 'NODE_NAME', defaultValue: 'oem-ci', description: 'Overwrite default node name to build on') + string(name: 'NODE_NAME', defaultValue: 'lxbuild4', description: 'Overwrite default node name to build on') booleanParam(name: 'CLEAN_BUILD', defaultValue: false, description: 'clean all temp directories before build starts') } @@ -52,6 +52,19 @@ pipeline { // correct build directory env.BUILD_DIR_POSTFIX = "" + // take the correct user ID for the ssh connection of + // the belonging build server + if("${params.NODE_NAME}" == "lxbuild4") { + env.SSH_ID = '6b90ac7f-9596-4e43-923b-6c9179a10d8a' + } + else if("${params.NODE_NAME}" == "lxbuild3") { + env.SSH_ID = '70c27394-cb7d-4304-aed1-89e15a3a78d0' + } + else { + env.SSH_ID = '' + } + println "SSH_ID used: ${env.SSH_ID}" + // load yocto common file env.ROOTDIR = pwd() yoctocommon = load "${env.ROOTDIR}/Jenkinsfile_Common" @@ -152,7 +165,7 @@ def cleanLeftOvers(cleaningDir) { //----------------------------------------------------------------------------- def build(imgType) { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { def tgtImgType = "${imgType}" == "bootloader" ? "dev" : "${imgType}" def imgTypePostfix = "${tgtImgType}" == "" ? "" : "-${tgtImgType}" sh "bash -c '. ./env.image-ostree > /dev/null && bitbake -q -k netmodule-linux-image${imgTypePostfix}'" diff --git a/Jenkinsfile_sdk b/Jenkinsfile_sdk index a83e0d6..df36c96 100644 --- a/Jenkinsfile_sdk +++ b/Jenkinsfile_sdk @@ -45,6 +45,19 @@ pipeline { // correct build directory env.BUILD_DIR_POSTFIX = "" + // take the correct user ID for the ssh connection of + // the belonging build server + if("${params.NODE_NAME}" == "lxbuild4") { + env.SSH_ID = '6b90ac7f-9596-4e43-923b-6c9179a10d8a' + } + else if("${params.NODE_NAME}" == "lxbuild3") { + env.SSH_ID = '70c27394-cb7d-4304-aed1-89e15a3a78d0' + } + else { + error("Declare the NODE_NAME specific to the build agent") + } + println "SSH_ID used: ${env.SSH_ID}" + // load yocto common file env.ROOTDIR = pwd() yoctocommon = load "${env.ROOTDIR}/Jenkinsfile_Common" @@ -79,7 +92,7 @@ pipeline { stage('build') { steps { script { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { if(env.IS_NM_LINUX_SDK.toBoolean()) { sh "bash -c '. ./env.image-ostree && bitbake -q netmodule-linux-sdk'" } @@ -124,7 +137,7 @@ def printJobParameters() { def cleanLastBuildArtifacts() { println "cleaning artifacts from last build..." sh "rm -f ${env.YOCTO_DEPLOYS}/*" - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { sh "bash -c '. ./env.image-ostree > /dev/null && git fetch -ap && bitbake -q -c cleanall netmodule-linux-sdk'" } } diff --git a/Jenkinsfile_update2head b/Jenkinsfile_update2head index 0a4fb70..a5fa9a8 100644 --- a/Jenkinsfile_update2head +++ b/Jenkinsfile_update2head @@ -2,7 +2,7 @@ pipeline { agent { node { - label 'oem-linux' + label 'lxbuild4' } } @@ -14,6 +14,7 @@ pipeline { environment { SUBMODULE_VERSION_FILE = "submodule_revisions" SOURCE_REVISION_UPDATE_LOG = "src_rev_update.log" + SSH_ID = '6b90ac7f-9596-4e43-923b-6c9179a10d8a' } options { @@ -66,6 +67,8 @@ pipeline { def printJobParameters() { + def node_name = "${NODE_NAME}" + println "Running on agent: ${node_name}\n\n" println "----------------------------------\n\ Job Parameters:\n\ ----------------------------------\n\ @@ -75,7 +78,7 @@ def printJobParameters() { } def prepareUpdate() { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { sh 'git submodule update --init' // init submodules used if first checkout } def userId = "${currentBuild.getBuildCauses()[0].userId}" @@ -94,7 +97,7 @@ def prepareUpdate() { } def updateSubmodules(isNmUpdate, isCommunityUpdate) { - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { if(isNmUpdate) { sh(script: "git submodule update --remote --rebase meta-netmodule-*") } @@ -131,7 +134,7 @@ def updateSourceRevisions(isNmUpdate) { def commitSourceRevisionChanges() { println "commit source revision changes..." - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { sh(returnStdout: true, script: "./src-rev-commit.sh -b develop -v -l ./srcrev-commit.log") } sh "cat ./srcrev-commit.log >> ./${env.SOURCE_REVISION_UPDATE_LOG}" @@ -152,7 +155,7 @@ def commitChanges(isNmUpdate, isCommunityUpdate) { println "everything up to date, nothing to commit" return } - sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) { + sshagent (credentials: [env.SSH_ID]) { sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes, triggered by ${env.TRIGGERED_USER}\" && git push") } }