代码拉取完成,页面将自动刷新
podTemplate(containers: [
containerTemplate(
name: 'golang',
command: 'cat',
image: 'golang:1.17.5',
ttyEnabled: true
),
containerTemplate(
name: 'kubectl',
command: 'cat',
image: 'harbor.wghdr.top/kaniko/kubectl:latest',
ttyEnabled: true
),
],
yaml: """
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: harbor.wghdr.top/kaniko/executor:latest
command:
- /busybox/cat
tty: true
volumeMounts:
- name: kaniko-secret
mountPath: /kaniko/.docker
restartPolicy: OnFailure
volumes:
- name: kaniko-secret
secret:
secretName: regcred
""".stripIndent()
) {
node(POD_LABEL) {
stage('clone') {
git credentialsId: 'gitee-user', url: 'https://gitee.com/wghdrr/cncamp.git'
}
stage('Compile') {
container('golang') {
sh """
make
"""
}
}
stage('Test') {
echo "Test Stage"
}
stage('build image') {
container(name: 'kaniko') {
sh """
/kaniko/executor -c `pwd` --dockerfile `pwd`/Dockerfile --destination harbor.wghdr.top/jenkins/httpserver:v1 --skip-tls-verify
"""
}
}
stage('deploy') {
withCredentials([file(credentialsId: 'kube-config', variable: 'KUBECONFIG')]) {
container('kubectl') {
sh """
mkdir -p ~/.kube && cp ${KUBECONFIG} ~/.kube/config
kubectl apply -f httpserver.yaml
"""
}
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。