| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- @Library("cmsis")
- DOCKERINFO = [
- 'linux_staging': [
- 'registryUrl': 'mcu--docker-staging.eu-west-1.artifactory.aws.arm.com',
- 'registryCredentialsId': 'artifactory',
- 'k8sPullSecret': 'artifactory-mcu-docker-staging',
- 'namespace': 'mcu--docker-staging',
- 'image': 'cmsis_fusa/linux',
- 'label': "${JENKINS_ENV}-${JOB_BASE_NAME}-${BUILD_NUMBER}"
- ],
- 'linux_production': [
- 'registryUrl': 'mcu--docker.eu-west-1.artifactory.aws.arm.com',
- 'registryCredentialsId': 'artifactory',
- 'namespace': 'mcu--docker',
- 'k8sPullSecret': 'artifactory-mcu-docker',
- 'image': 'cmsis_fusa/linux',
- 'label': 'aws'
- ],
- 'windows_staging': [
- 'registryUrl': 'mcu--docker-staging.eu-west-1.artifactory.aws.arm.com',
- 'registryCredentialsId': 'artifactory',
- 'namespace': 'mcu--docker-staging',
- 'image': 'cmsis_fusa/windows',
- 'label': "${JENKINS_ENV}-${JOB_BASE_NAME}-${BUILD_NUMBER}"
- ],
- 'windows_production': [
- 'registryUrl': 'mcu--docker.eu-west-1.artifactory.aws.arm.com',
- 'registryCredentialsId': 'artifactory',
- 'namespace': 'mcu--docker',
- 'image': 'cmsis_fusa/windows',
- 'label': 'aws'
- ]
- ]
- dockerinfo_linux = DOCKERINFO['linux_production']
- dockerinfo_windows = DOCKERINFO['windows_production']
- isPrecommit = (JOB_BASE_NAME == 'pre_commit')
- isNightly = (JOB_BASE_NAME == 'nightly')
- patternGlobal = [
- '^Jenkinsfile'
- ]
- patternCoreM = [
- '^CMSIS/Core/Include/.*',
- '^Device/ARM/ARMCM.*'
- ]
- patternCoreA = [
- '^CMSIS/Core_A/Include/.*',
- '^Device/ARM/ARMCA.*'
- ]
- patternCoreValidation = [
- '^CMSIS/CoreValidation/.*'
- ]
- CONFIGURATIONS = [
- 'pre_commit': [
- 'mdevices': ['CM0', 'CM3', 'CM4FP', 'CM7DP', 'CM23', 'CM33NS', 'CM35PS'],
- 'adevices': ['CA7', 'CA9neon'],
- 'devices' : [],
- 'configs' : [
- 'AC6': ['low', 'tiny'],
- 'AC6LTM': ['low', 'tiny']
- ]
- ],
- 'nightly':[
- 'devices' : ['CM0', 'CM0plus', 'CM3', 'CM4', 'CM4FP', 'CM7', 'CM7SP', 'CM7DP',
- 'CM23', 'CM23S', 'CM23NS', 'CM33', 'CM33S', 'CM33NS',
- 'CM35P', 'CM35PS', 'CM35PNS',
- 'CA5', 'CA5neon', 'CA7', 'CA7neon', 'CA9', 'CA9neon'],
- 'configs' : [
- 'AC6': ['low', 'mid', 'high', 'size', 'tiny'],
- 'AC6LTM': ['low', 'mid', 'high', 'size', 'tiny']
- ]
- ]
- ]
- CONFIGURATION = CONFIGURATIONS[JOB_BASE_NAME]
- // ---- PIPELINE CODE ----
- def getChangeset() {
- def fileset = sh encoding: 'UTF-8', label: '', returnStdout: true, script: 'git diff --name-only HEAD~1..HEAD'
- return fileset.split('\n')
- }
- def fileSetMatches(fileset, patternset) {
- return patternset.any { p ->
- fileset.any{ f -> f ==~ p }
- }
- }
- FORCE_BUILD = false
- CORE_VALIDATION = true
- COMMIT = null
- VERSION = null
- pipeline {
- options {
- timestamps()
- timeout(time: 1, unit: 'HOURS')
- ansiColor('xterm')
- skipDefaultCheckout()
- }
- agent { label 'master' }
- stages {
- stage('Checkout') {
- steps {
- script {
- COMMIT = checkoutScmWithRetry(3)
- echo "COMMIT: ${COMMIT}"
- VERSION = (sh(returnStdout: true, script: 'git describe --always')).trim()
- echo "VERSION: '${VERSION}'"
- }
- }
- }
- stage('Analyse') {
- when {
- expression { return isPrecommit }
- beforeOptions true
- }
- steps {
- script {
- def fileset = changeset
- def hasGlobal = fileSetMatches(fileset, patternGlobal)
- def hasCoreM = fileSetMatches(fileset, patternCoreM)
- def hasCoreA = fileSetMatches(fileset, patternCoreA)
- def hasCoreValidation = fileSetMatches(fileset, patternCoreValidation)
- echo """Change analysis:
- - hasGlobal = ${hasGlobal}
- - hasCoreM = ${hasCoreM}
- - hasCoreA = ${hasCoreA}
- - hasCoreValidation = ${hasCoreValidation}
- """
- if (hasGlobal || hasCoreM || hasCoreValidation) {
- CONFIGURATION['devices'] += CONFIGURATION['mdevices']
- }
- if (hasGlobal || hasCoreA || hasCoreValidation) {
- CONFIGURATION['devices'] += CONFIGURATION['adevices']
- }
- CORE_VALIDATION &= hasGlobal || hasCoreM || hasCoreA || hasCoreValidation
-
- echo """Stage schedule:
- - CORE_VALIDATION = ${CORE_VALIDATION}
- """
- }
- }
- }
- stage('CoreValidation') {
- when {
- expression { return CORE_VALIDATION }
- beforeOptions true
- }
- matrix {
- axes {
- axis {
- name 'DEVICE'
- values 'CM0', 'CM0plus', 'CM3', 'CM4', 'CM4FP', 'CM7', 'CM7SP', 'CM7DP',
- 'CM23', 'CM23S', 'CM23NS', 'CM33', 'CM33S', 'CM33NS',
- 'CM35P', 'CM35PS', 'CM35PNS',
- 'CA5', 'CA5neon', 'CA7', 'CA7neon', 'CA9', 'CA9neon'
- }
- }
- stages {
- stage('Test') {
- when {
- expression { return DEVICE in CONFIGURATION['devices'] }
- beforeOptions true
- }
- agent {
- kubernetes {
- defaultContainer 'cmsis'
- slaveConnectTimeout 600
- yaml """\
- apiVersion: v1
- kind: Pod
- spec:
- imagePullSecrets:
- - name: ${dockerinfo_linux['k8sPullSecret']}
- securityContext:
- runAsUser: 1000
- runAsGroup: 1000
- containers:
- - name: cmsis
- image: ${dockerinfo_linux['registryUrl']}/${dockerinfo_linux['image']}:${dockerinfo_linux['label']}
- alwaysPullImage: true
- imagePullPolicy: Always
- command:
- - sleep
- args:
- - infinity
- resources:
- requests:
- cpu: 2
- memory: 2Gi
- """.stripIndent()
- }
- }
- steps {
- checkoutScmWithRetry(3)
- dir('CMSIS/CoreValidation/Tests') {
- script {
- CONFIGURATION['configs'].each { COMPILER, OPTS ->
- tee("CV_${COMPILER}_${DEVICE}.log") {
- sh "python3 build.py -d ${DEVICE} -c ${COMPILER} -o ${OPTS.join(' -o ')} build run"
- }
- }
- }
- archiveArtifacts artifacts: "CoreValidation_*.zip", allowEmptyArchive: true
- stash name: "CV_${DEVICE}", includes: '*.log, *.junit'
- }
- }
- }
- }
- }
- }
- stage('Results') {
- steps {
- dir('results') {
- deleteDir()
- script {
- CONFIGURATION['devices'].each { unstash "CV_${it}" }
- }
- recordIssues tools: [clang(id: 'AC6', name: 'Arm Compiler 6', pattern: 'CV_AC6_*.log'),
- clang(id: 'AC6LTM', name: 'Arm Compiler 6 LTM', pattern: 'CV_AC6LTM_*.log')],
- qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]],
- referenceJobName: 'nightly', ignoreQualityGate: true
- xunit([
- JUnit(pattern: 'corevalidation_*.junit', failIfNotNew: false, skipNoTestFiles: true)
- ])
- }
- }
- }
- }
- }
|