Jenkins: Add release promotion stage.
@Library("cmsis")
+import com.arm.dsg.cmsis.jenkins.ArtifactoryHelper
DOCKERINFO = [
'staging': [
@@ -24,6 +25,7 @@ dockerinfo = DOCKERINFO['production']
isPrecommit = (JOB_BASE_NAME == 'pre_commit')
isPostcommit = (JOB_BASE_NAME == 'post_commit')
isNightly = (JOB_BASE_NAME == 'nightly')
+isRelease = (JOB_BASE_NAME == 'release')
patternGlobal = [
'^Jenkinsfile'
@@ -82,7 +84,8 @@ CONFIGURATIONS = [
'AC6LTM': ['low', 'mid', 'high', 'size', 'tiny'],
'GCC': ['low', 'mid', 'high', 'size', 'tiny']
]
- ]
+ ],
+ 'release': []
]
CONFIGURATION = CONFIGURATIONS[JOB_BASE_NAME]
@@ -100,11 +103,13 @@ def fileSetMatches(fileset, patternset) {
}
FORCE_BUILD = false
-DOCKER_BUILD = true
-CORE_VALIDATION = true
+DOCKER_BUILD = isPrecommit || isPostcommit || isNightly
+CORE_VALIDATION = isPrecommit || isPostcommit || isNightly
COMMIT = null
VERSION = null
+artifactory = new ArtifactoryHelper(this)
+
pipeline {
agent { label 'master' }
options {
@@ -320,6 +325,7 @@ echo """Stage schedule:
sh('./CMSIS/Utilities/gen_pack.sh')
archiveArtifacts artifacts: 'output/ARM.CMSIS.*.pack', allowEmptyArchive: true
+ stash name: 'pack', includes: 'output/ARM.CMSIS.*.pack'
recordIssues tools: [doxygen(id: 'DOXYGEN', name: 'Doxygen', pattern: 'doxygen.log')],
qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]],
@@ -471,5 +477,31 @@ echo """Stage schedule:
}
}
}
+
+ stage('Release Promote') {
+ when {
+ expression { return isRelease }
+ beforeOptions true
+ }
+ steps {
+ unstash name: 'pack'
+ dir('output') {
+ script {
+ artifactory.upload pattern: 'ARM.CMSIS.*.pack',
+ target: "mcu.promoted/CMSIS_5/${VERSION}/",
+ props: "GIT_COMMIT=${COMMIT['GIT_COMMIT']}"
+ }
+ withCredentials([string(credentialsId: 'grasci_github', variable: 'ghtoken')]) {
+ sh("""
+ curl -XPOST \
+ -H "Authorization:token ${ghtoken}" \
+ -H "Content-Type:application/octet-stream" \
+ --data-binary @ARM.CMSIS.${VERSION}.pack \
+ https://uploads.github.com/repos/ARM-software/CMSIS_5/releases/${VERSION}/assets?name=ARM.CMSIS.${VERSION}.pack')
+
+ }
+ }
+ }
+ }
}
}
