Add in Jenkinsfile
Some checks failed
Homelab/ansible-playbook-runner/pipeline/head There was a failure building this commit
Some checks failed
Homelab/ansible-playbook-runner/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1251f74d38
commit
f117f82ec0
8
.groovylintrc.json
Normal file
8
.groovylintrc.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "recommended",
|
||||
"rules": {
|
||||
"CompileStatic": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Jenkinsfile
vendored
Normal file
42
Jenkinsfile
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
podLabel = "image-build-${UUID.randomUUID()}"
|
||||
containerRegistry = 'docker.home.thejimnicholson.com/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_HASH} \
|
||||
--destination=${containerRegistry}/${containerImage}:latest"
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
archiveArtifacts artifacts: '*.tar', followSymlinks: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user