From 5359b74d30a348f6c77b8362b4683b3d4a84a588 Mon Sep 17 00:00:00 2001 From: Marc Mattmueller Date: Wed, 27 Jan 2021 09:51:26 +0100 Subject: [PATCH] jenkins: creating revision files and archive them BugzID: 69785 Signed-off-by: Marc Mattmueller --- Jenkinsfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index e5f3020..05bb6b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,8 @@ pipeline { buildhistory = "${SHARED_BUILD}/buildhistory" DISTO_VERSION_FILE = "${SHARED_BUILD}/conf/distro_version.inc" + SUBMODULE_VERION_FILE = "${WORKSPACE}/submodule_revisions" + AUTOREV_VERSION_FILE = "${WORKSPACE}/autorev_revisions.inc" } options { @@ -72,6 +74,20 @@ pipeline { } } + stage('collect versions') { + steps { + script { + revisions = getAutoRevHashes() + writeFile(file: "${env.AUTOREV_VERSION_FILE}", text: "${revisions}") + } + } + post { + success { + archiveArtifacts(artifacts: "${env.SUBMODULE_VERION_FILE},${env.AUTOREV_VERSION_FILE},${env.DISTO_VERSION_FILE}", onlyIfSuccessful: false) + } + } + } + stage('build') { steps { script { @@ -104,6 +120,7 @@ def handle_submodules(versionParam) { } submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log println "${submoduleStatus}" + writeFile(file: "${env.SUBMODULE_VERION_FILE}", text: "${submoduleStatus}") } def build_version(versionParam) { @@ -245,3 +262,9 @@ def getTopUpstreamBuildNumber() { println "Top upstream job build Number = ${topJobNbr}" return topJobNbr } + +def getAutoRevHashes() { + sh(script: "bash -c '. ./env.image-ostree && bitbake netmodule-linux-image-dev --runall=fetch'") + def revs = sh(returnStdout: true, script: "bash -c \". ./env.image-ostree && clear && buildhistory-collect-srcrevs | sort | uniq | grep -v \"#\"\"").trim() + return revs +} \ No newline at end of file