From 4e6ab5f91c7f95f11cf9c167adcc9403eab36550 Mon Sep 17 00:00:00 2001 From: Luca Lutz Date: Mon, 26 Jun 2023 11:01:11 +0000 Subject: [PATCH] Update 2 files - /Jenkinsfile - /.gitlab-ci.yml --- .gitlab-ci.yml | 19 ++++++++++++++++++ Jenkinsfile | 54 -------------------------------------------------- 2 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 Jenkinsfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b98907e --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 0a62865..0000000 --- a/Jenkinsfile +++ /dev/null @@ -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)' - } - } - } - } - } - } - } -} -