Some checks failed
Homelab/ansible-playbook-runner/pipeline/head There was a failure building this commit
43 lines
1.2 KiB
Groovy
43 lines
1.2 KiB
Groovy
#!/usr/bin/env groovy
|
|
|
|
podLabel = "image-build-${UUID.randomUUID()}"
|
|
containerRegistry = '10.0.96.5/ansible-playbook-runner'
|
|
containerImage = 'ansible-playbook-runner'
|
|
|
|
podTemplate(label: podLabel, containers: [
|
|
containerTemplate(
|
|
name: 'kaniko',
|
|
image: 'gcr.io/kaniko-project/executor:debug',
|
|
command: 'sleep',
|
|
args: '30d'
|
|
)
|
|
], workspaceVolume: dynamicPVC()) {
|
|
node(podLabel) {
|
|
stage('Checkout') {
|
|
checkout scm
|
|
sh 'git fetch'
|
|
GIT_TAG = sh(
|
|
script: 'git describe --tags --always --dirty=-dirty',
|
|
returnStdout: true
|
|
).trim()
|
|
}
|
|
container('kaniko') {
|
|
stage('Image') {
|
|
ansiColor('css') {
|
|
sh "/kaniko/executor \
|
|
-f `pwd`/Dockerfile \
|
|
-c `pwd` \
|
|
--insecure \
|
|
--skip-tls-verify \
|
|
--tarPath ./${containerImage}-${GIT_TAG}.image.tar \
|
|
--destination=${containerRegistry}/${containerImage}:${GIT_TAG} \
|
|
--destination=${containerRegistry}/${containerImage}:latest"
|
|
}
|
|
}
|
|
stage('Archive') {
|
|
archiveArtifacts artifacts: '*.tar', followSymlinks: false
|
|
}
|
|
}
|
|
}
|
|
}
|