x86_64-alpine-watcher/Jenkinsfile
Jonathan Ervine 55c9fca389 modified: Dockerfile
modified:   Jenkinsfile
Added k8s auto-deploy to jenkinsfile
2020-04-06 15:19:31 +08:00

24 lines
736 B
Groovy

node("docker-node") {
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
git branch: "3.10.3", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-alpine-watcher", credentialsId: 'jenkins-to-git'
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
try {
stage "build"
def app = docker.build "library/x86_64/alpine-3.10/watcher"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
stage('Deploy on K8s'){
sh "/usr/local/bin/kubectl -n media delete po watcher-0"
}
}
}
}