Using node builder
This commit is contained in:
parent
9ff4cee802
commit
c83657c8f1
48
Jenkinsfile
vendored
48
Jenkinsfile
vendored
@ -1,18 +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", 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
|
||||||
stage "build"
|
tty: true
|
||||||
def app = docker.build "library/x86_64/alpine/alpine"
|
volumeMounts:
|
||||||
|
- name: jenkins-docker-cfg
|
||||||
stage "publish"
|
mountPath: /kaniko/.docker
|
||||||
app.push("${env.BUILD_NUMBER}")
|
volumes:
|
||||||
app.push("latest")
|
- name: jenkins-docker-cfg
|
||||||
app.push("3.12")
|
projected:
|
||||||
|
sources:
|
||||||
|
- secret:
|
||||||
|
name: regcred
|
||||||
|
items:
|
||||||
|
- key: .dockerconfigjson
|
||||||
|
path: config.json
|
||||||
|
"""
|
||||||
|
) {
|
||||||
|
|
||||||
|
node(POD_LABEL) {
|
||||||
|
stage('Build with Kaniko') {
|
||||||
|
git 'https://git.ervine.org/jonny/x86_64-alpine.git'
|
||||||
|
container('kaniko') {
|
||||||
|
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/alpine:latest --destination=harbor.ervine.dev/library/x86_64/alpine:3.12.0 --destionation=harbor.ervine.org/library/x86_64/alpine:3.12'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
Jenkinsfile.old
Normal file
18
Jenkinsfile.old
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
node("docker-node") {
|
||||||
|
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
|
||||||
|
|
||||||
|
git branch: "master", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine", credentialsId: 'jenkins-to-git'
|
||||||
|
|
||||||
|
sh "git rev-parse HEAD > .git/commit-id"
|
||||||
|
def commit_id = readFile('.git/commit-id').trim()
|
||||||
|
println commit_id
|
||||||
|
|
||||||
|
stage "build"
|
||||||
|
def app = docker.build "library/x86_64/alpine/alpine"
|
||||||
|
|
||||||
|
stage "publish"
|
||||||
|
app.push("${env.BUILD_NUMBER}")
|
||||||
|
app.push("latest")
|
||||||
|
app.push("3.12")
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user