Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 20:35:10 +08:00
parent 97fd26b2a2
commit 26040e2a95
2 changed files with 33 additions and 27 deletions

View File

@ -11,7 +11,7 @@ ENV LANG='en_US.UTF-8' \
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk update && \ apk update && \
apk -U upgrade && \ apk -U upgrade --ignore alpine-baselayout && \
apk -U add python3 git py-setuptools apk -U add python3 git py-setuptools
ADD UTC /etc/localtime ADD UTC /etc/localtime

58
Jenkinsfile vendored
View File

@ -1,28 +1,34 @@
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-tautulli", 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/tautulli" - 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("2.5.3") sources:
app.push("2.5") - secret:
name: regcred
stage('Deploy on k8s'){ items:
sh "/usr/local/bin/kubectl -n media delete po tautulli-0" - key: .dockerconfigjson
} path: config.json
} """
catch (err) { ) {
currentBuild.result = 'FAILURE'
} node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-tautulli.git', credentialsId: 'jenkins-to-git'
container('kaniko') {
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/alpine/tautulli:2.5.3 --destination=harbor.ervine.dev/library/x86_64/alpine/tautulli:2.5'
}
} }
}
} }