aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-07-22 14:59:41 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-07-22 14:59:41 +0200
commit31062ed53cf7a2745bc622457f9819fb98fcf887 (patch)
tree2273b09a43c363ef80cb5803ea2811d02729b37c
parent3fbd557931bc2b324429a9379ac2abb6f0ca0e65 (diff)
downloadpodman-docker-builder-31062ed53cf7a2745bc622457f9819fb98fcf887.tar.gz
add nocache variant
-rw-r--r--gitlab-ci-template-nocache.yml45
1 files changed, 45 insertions, 0 deletions
diff --git a/gitlab-ci-template-nocache.yml b/gitlab-ci-template-nocache.yml
new file mode 100644
index 0000000..e5b8cae
--- /dev/null
+++ b/gitlab-ci-template-nocache.yml
@@ -0,0 +1,45 @@
+# https://blog.callr.tech/building-docker-images-with-gitlab-ci-best-practices/
+# comments dropped, updated for podman builds
+# this variant builds without caching
+
+image: registry.gitlab.com/kraxel/podman-docker-builder:latest
+
+stages:
+ - build
+ - push
+
+before_script:
+ - podman login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+
+Build:
+ stage: build
+ script:
+ - >
+ podman build
+ --build-arg VCS_REF=$CI_COMMIT_SHA
+ --build-arg VCS_URL=$CI_PROJECT_URL
+ --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ .
+ - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+
+Push latest:
+ variables:
+ GIT_STRATEGY: none
+ stage: push
+ only:
+ - master
+ script:
+ - podman pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ - podman tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
+ - podman push $CI_REGISTRY_IMAGE:latest
+
+Push tag:
+ variables:
+ GIT_STRATEGY: none
+ stage: push
+ only:
+ - tags
+ script:
+ - podman pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ - podman tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
+ - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME