mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
调整dockerfile
This commit is contained in:
44
Jenkinsfile
vendored
44
Jenkinsfile
vendored
@@ -8,6 +8,15 @@ pipeline{
|
||||
}
|
||||
|
||||
|
||||
parameters {
|
||||
string(
|
||||
name: 'BUILD_TIME',
|
||||
defaultValue: new Date().format("yyyy-MM-dd-HH-mm-ss", TimeZone.getTimeZone("Asia/Shanghai")),
|
||||
description: 'Build time in UTC'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
triggers {
|
||||
pollSCM 'H/3 * * * * '
|
||||
}
|
||||
@@ -18,13 +27,14 @@ pipeline{
|
||||
|
||||
|
||||
steps{
|
||||
withCredentials([usernamePassword(credentialsId: 'harbor-ci', passwordVariable: 'p', usernameVariable: 'u')]) {
|
||||
withCredentials([usernamePassword(credentialsId: 'codeup_lihongjie0209', passwordVariable: 'p', usernameVariable: 'u')]) {
|
||||
|
||||
sh "docker login -u ${u} -p ${p} 192.168.0.118"
|
||||
sh "docker login -u ${u} -p ${p} registry.cn-beijing.aliyuncs.com"
|
||||
}
|
||||
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}"
|
||||
sh "docker build . -t registry.cn-beijing.aliyuncs.com/lihongjie/coal:${env.BRANCH_NAME}-latest"
|
||||
sh "docker tag registry.cn-beijing.aliyuncs.com/lihongjie/coal:${env.BRANCH_NAME}-latest registry.cn-beijing.aliyuncs.com/lihongjie/coal:${env.BRANCH_NAME}-${params.BUILD_TIME}"
|
||||
sh "docker push registry.cn-beijing.aliyuncs.com/lihongjie/coal:${env.BRANCH_NAME}-latest"
|
||||
sh "docker push registry.cn-beijing.aliyuncs.com/lihongjie/coal:${env.BRANCH_NAME}-${params.BUILD_TIME}"
|
||||
|
||||
}
|
||||
|
||||
@@ -34,18 +44,18 @@ pipeline{
|
||||
|
||||
|
||||
|
||||
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}"
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 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}"
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user