1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | agent { label 'slave' } options { timestamps() parallelsAlwaysFailFast() timeout(time: 600 , unit: 'SECONDS' ) disableConcurrentBuilds(abortPrevious: true ) buildDiscarder(logRotator(numToKeepStr: '30' )) skipDefaultCheckout() } environment { String year = new Date().format( "yyyy" ) String month = new Date().format( "MMdd" ) String day = new Date().format( "HHmm" ) String second = new Date().format( "ss" ) images_head = "registry.cn-hangzhou.aliyuncs.com" giturl = "http://10.0.7.30/golang/go.git" } parameters { choice choices: [ 'main' , 'pre' , 'test' ], name: 'branch_name' } stages { stage( '克隆代码' ) { agent { docker { label 'slave' image 'registry.cn-hangzhou.aliyuncs.com/tool-bucket/tool:git' } } steps { script { cleanWs() tools.PrintMessage( "1.克隆代码" , "blue" ) checkout.scm(branch_name,giturl) } } } stage( 'sonar扫描' ) { agent { docker { label 'slave' image 'sonarsource/sonar-scanner-cli' } } steps { script { tools.PrintMessage( "1.sonar扫描" , "blue" ) withSonarQubeEnv( 'sonarqube' ) { sh "" " sonar-scanner \ -Dsonar.projectKey=test-go \ -Dsonar.projectName=test-go \ -Dsonar.projectVersion=test-go-${BUILD_NUMBER} \ -Dsonar.ws.timeout= 30 \ -Dsonar.sources=. \ -Dsonar.sourceEncoding=UTF- 8 sleep 3 "" " } } } } stage( "Quality Gate" ){ steps { script { tools.PrintMessage( "2.Quality Gate" , "blue" ) timeout(time: 10 , unit: 'SECONDS' ) { def qg = waitForQualityGate( 'sonarqube' ) if (qg.status != 'OK' ) { error "未通过Sonarqube的代码质量阈检查,请及时修改!failure: ${qg.status}" } } } } } } |
registry.cn-hangzhou.aliyuncs.com/tool-bucket/tool:git 这个镜像从哪里来 ?