Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 21:03:09 +08:00
parent 74f147fb51
commit 9c2a937897

57
Jenkinsfile vendored
View File

@ -1,28 +1,35 @@
node("docker-node") { podTemplate(yaml: """
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { kind: Pod
spec:
git branch: "master", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-wetty", credentialsId: 'jenkins-to-git' containers:
- name: kaniko
sh "git rev-parse HEAD > .git/commit-id" image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251
def commit_id = readFile('.git/commit-id').trim() imagePullPolicy: Always
println commit_id command:
- /busybox/cat
try { tty: true
stage "build" volumeMounts:
def app = docker.build "library/x86_64/alpine/wetty" - name: jenkins-docker-cfg
mountPath: /kaniko/.docker
stage "publish" volumes:
app.push("${env.BUILD_NUMBER}") - name: jenkins-docker-cfg
app.push("latest") projected:
app.push("master") sources:
app.push("1.3") - secret:
name: regcred
items:
- key: .dockerconfigjson
path: config.json
"""
) {
stage('Deploy on K8s'){ node(POD_LABEL) {
sh "/usr/local/bin/kubectl -n wetty delete po --all" stage('Build with Kaniko') {
} git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-wetty.git', credentialsId: 'jenkins-to-git'
} container('kaniko') {
catch (err) { sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/alpine/wetty:1.3'
currentBuild.result = 'FAILURE' }
}
} }
}
} }