mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
54 lines
987 B
Groovy
54 lines
987 B
Groovy
pipeline{
|
|
|
|
agent any
|
|
|
|
options {
|
|
|
|
disableConcurrentBuilds()
|
|
}
|
|
|
|
|
|
triggers {
|
|
pollSCM 'H/3 * * * * '
|
|
}
|
|
stages{
|
|
|
|
|
|
stage("打包"){
|
|
|
|
|
|
steps{
|
|
withCredentials([usernamePassword(credentialsId: 'harbor-ci', passwordVariable: 'p', usernameVariable: 'u')]) {
|
|
|
|
sh "docker login -u ${u} -p ${p} 192.168.0.118"
|
|
}
|
|
sh "docker build . -t coal:${env.BRANCH_NAME}"
|
|
sh "docker tag coal:${env.BRANCH_NAME} 192.168.0.118/coal/coal:${env.BRANCH_NAME}"
|
|
sh "docker push 192.168.0.118/coal/coal:${env.BRANCH_NAME}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stage("重新部署"){
|
|
|
|
|
|
steps{
|
|
|
|
sh "kubectl --kubeconfig=homelab.yaml apply -k k8s/${env.BRANCH_NAME}/"
|
|
sh "kubectl --kubeconfig=homelab.yaml rollout restart deployment/coal-api --namespace coal-${env.BRANCH_NAME}"
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |