mirror of
https://gitlab.com/sfz.aalen/infra/fabaccess.git
synced 2025-03-12 06:51:46 +01:00
Add Jenkinsfile
This commit is contained in:
parent
b1ba764956
commit
82a899fd84
54
Jenkinsfile
vendored
Normal file
54
Jenkinsfile
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
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)'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user