请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

tool.git 这个镜像 从哪里创建 ?

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    这个镜像从哪里来 ?   

正在回答 回答被采纳积分+3

插入代码

1回答

小杨_老师 2025-01-22 17:44:44
这是在我自己阿里云账号公网镜像
0 回复 有任何疑惑可以回复我~
  • 提问者 CAT1235 #1
    有dockerfile参考一下吗 ?
    回复 有任何疑惑可以回复我~ 2025-01-22 17:48:38
  • 小杨_老师 回复 提问者 CAT1235 #2
    没有dockerfile哦,你可以自己制作一个所需要环境镜像
    回复 有任何疑惑可以回复我~ 2025-01-22 18:17:59
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号