mirror of
https://gitlab.com/sfz.aalen/infra/fabaccess.git
synced 2025-03-12 15:01:47 +01:00
55 lines
1.8 KiB
Plaintext
55 lines
1.8 KiB
Plaintext
|
pipeline {
|
||
|
agent any
|
||
|
post {
|
||
|
failure {
|
||
|
updateGitlabCommitStatus name: 'build', state: 'failed'
|
||
|
}
|
||
|
success {
|
||
|
updateGitlabCommitStatus name: 'build', state: 'success'
|
||
|
}
|
||
|
aborted {
|
||
|
updateGitlabCommitStatus name: 'build', state: 'canceled'
|
||
|
}
|
||
|
}
|
||
|
options {
|
||
|
gitLabConnection('GitLab')
|
||
|
}
|
||
|
triggers {
|
||
|
gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
|
||
|
}
|
||
|
stages {
|
||
|
stage("build") {
|
||
|
steps {
|
||
|
updateGitlabCommitStatus name: 'build', state: 'running'
|
||
|
podTemplate(
|
||
|
containers: [
|
||
|
containerTemplate(name: 'docker-image-build', image: 'mgoltzsche/podman', ttyEnabled: true, command: 'cat', privileged: true),
|
||
|
]) {
|
||
|
node(POD_LABEL) {
|
||
|
updateGitlabCommitStatus name: 'build', state: 'pending'
|
||
|
checkout([$class: 'GitSCM', branches: [
|
||
|
[name: '*/main']
|
||
|
], userRemoteConfigs: [
|
||
|
[url: 'https://gitlab.com/luca_lutz/fabaccess.git']
|
||
|
]])
|
||
|
container('docker-image-build') {
|
||
|
withCredentials([
|
||
|
usernamePassword(credentialsId: 'docker.credentials',
|
||
|
usernameVariable: 'DOCKER_USERNAME',
|
||
|
passwordVariable: 'DOCKER_PASSWORD')
|
||
|
]) {
|
||
|
sh 'echo $(date +%s) > /time'
|
||
|
sh 'echo "nameserver 10.12.42.2" > /etc/resolv.conf'
|
||
|
sh 'podman build --tag docker.sfz-aalen.space/hackwerk/fabaccess:$(cat /time) .'
|
||
|
sh 'podman login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} docker.sfz-aalen.space'
|
||
|
sh 'podman push docker.sfz-aalen.space/hackwerk/fabaccess:$(cat /time)'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|