관리-도구
편집 파일: Jenkinsfile
JOB_NAME_AS_ID = null def setupLinuxTest(enablerFlag, architecture, block) { if (enablerFlag) { node("linux && ${architecture}") { withEnv([ "OUTPUT_DIR=${env.WORKSPACE}/output-linux-${architecture}", "CACHE_DIR=${env.JENKINS_HOME}/cache/${env.JOB_NAME_AS_ID}/linux-${architecture}/executor-${env.EXECUTOR_NUMBER}", "ARCHITECTURE=${architecture}" ], block) } } else { echo 'Test skipped.' } } def setupMacosTest(enablerFlag, block) { if (enablerFlag) { node('macos') { withEnv([ "OUTPUT_DIR=${env.WORKSPACE}/output-macos", "CACHE_DIR=${env.WORKSPACE}/cache/${env.JOB_NAME_AS_ID}/macos/executor-${env.EXECUTOR_NUMBER}", "RUNTIME_DIR=${env.WORKSPACE}/cache/${env.JOB_NAME_AS_ID}/macos/executor-${env.EXECUTOR_NUMBER}/runtime" ], block) } } else { echo 'Test skipped.' } } pipeline { agent { node { label 'master-pipeline' } } options { buildDiscarder(logRotator(numToKeepStr: '10')) timeout(time: 45, unit: 'MINUTES') disableConcurrentBuilds() timestamps() ansiColor('xterm') } parameters { booleanParam(name: 'LINUX_X86_64', defaultValue: true, description: 'Linux x86_64 binaries') booleanParam(name: 'LINUX_ARM64', defaultValue: true, description: 'Linux arm64 binaries') booleanParam(name: 'MACOS', defaultValue: true, description: 'macOS binaries') } stages { stage('Initialize') { steps { script { // The syntaxes 'env.FOO = FOO = ...' and 'FOO = env.FOO = ...' // do not work for some reason; one of them will become null. // So we split the assignments in two separate statements. env.JOB_NAME_AS_ID = env.JOB_NAME.replace(' ', '-') JOB_NAME_AS_ID = env.JOB_NAME_AS_ID if (env.JOB_NAME.indexOf('Enterprise') != -1) { env.ENTERPRISE = '1' } else { env.ENTERPRISE = '0' } // For debugging purposes sh 'env | sort' } } } stage('Build') { steps { script { parallel( 'Linux x86_64': { setupLinuxTest(params.LINUX_X86_64, 'x86_64') { checkout scm sh './dev/ci/tests/binaries/build-linux' archiveArtifacts artifacts: 'output-linux-x86_64/**/*' sh './dev/ci/tests/binaries/test-linux' } }, 'Linux arm64': { setupLinuxTest(params.LINUX_ARM64, 'aarch64') { checkout scm sh './dev/ci/tests/binaries/build-linux' archiveArtifacts artifacts: 'output-linux-aarch64/**/*' sh './dev/ci/tests/binaries/test-linux' } }, 'macOS': { setupMacosTest(params.MACOS) { checkout scm sh './dev/ci/tests/binaries/prepare-macos' sh './dev/ci/tests/binaries/build-macos' archiveArtifacts artifacts: 'output-macos/**/*' sh './dev/ci/tests/binaries/test-macos' } } ) } } } } }