1 Star 0 Fork 0

wghdr/cncamp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Jenkinsfile 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
wghdr 提交于 2022-08-10 04:00 . update Jenkinsfile.
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
"""
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/wghdrr/cncamp.git
git@gitee.com:wghdrr/cncamp.git
wghdrr
cncamp
cncamp
master

搜索帮助