mirror of
https://gitlab.com/sfz.aalen/infra/fabaccess.git
synced 2025-03-12 15:01:47 +01:00
Update 2 files
- /Jenkinsfile - /.gitlab-ci.yml
This commit is contained in:
parent
fd056321d3
commit
4e6ab5f91c
19
.gitlab-ci.yml
Normal file
19
.gitlab-ci.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
variables:
|
||||||
|
SFZ_REGISTRY_IMAGE: $SFZ_REGISTRY/$CI_PROJECT_PATH
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
image: quay.io/podman/stable
|
||||||
|
stage: build
|
||||||
|
before_script:
|
||||||
|
- podman login -u "$SFZ_REGISTRY_USER" -p "$SFZ_REGISTRY_PASSWORD" $SFZ_REGISTRY
|
||||||
|
# Default branch leaves tag empty (= latest tag)
|
||||||
|
# All other branches are tagged with the escaped branch name (commit ref slug)
|
||||||
|
script:
|
||||||
|
- tag=$(date +%s)
|
||||||
|
- podman build --pull -t "$SFZ_REGISTRY_IMAGE:${tag}" .
|
||||||
|
- podman push "$SFZ_REGISTRY_IMAGE:${tag}"
|
||||||
|
# Run this job in a branch where a Dockerfile exists
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
exists:
|
||||||
|
- Dockerfile
|
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@ -1,54 +0,0 @@
|
|||||||
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