From 46e443b25efec47e11a613b2f1ce9c3f3d91ca89 Mon Sep 17 00:00:00 2001 From: Dimitra Chatzichrysou <dimitra.chatzichrysou@cern.ch> Date: Mon, 2 May 2022 16:13:07 +0200 Subject: [PATCH] Update .gitlab-ci.yml --- .gitlab-ci.yml | 33 ++++++++----------- .../templates/database-restore.yaml | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c14c0db..88062ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,23 +1,16 @@ +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS' + when: never + - if: '$CI_COMMIT_BRANCH' + +include: + - project: 'paas-tools/infrastructure-ci' + file: 'docker-images-ci-templates/DockerImages.gitlab-ci.yml' + stages: - build -build: - stage: build - image: - # We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder - name: gitlab-registry.cern.ch/ci-tools/docker-image-builder - entrypoint: [""] - script: - - | - case "$CI_COMMIT_BRANCH" in - master) export DATE=$(date -u +%Y.%m.%dT%H-%M-%SZ); export TAG="RELEASE"-${DATE}; echo "TAG=$TAG" >> build.env ;; - *) export TAG=$CI_COMMIT_SHORT_SHA ;; - esac - # This is not the common Authentication config, unknown reason why common config fails - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json - # Image builder - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination ${CI_REGISTRY_IMAGE}/velero-restore:${CI_COMMIT_BRANCH}-${TAG} - - echo "Image pushed successfully to ${CI_REGISTRY_IMAGE}/velero-restore:${CI_COMMIT_BRANCH}-${TAG}" - artifacts: - reports: - dotenv: build.env +variables: + CI_REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE}/velero-restore diff --git a/chart/drupal-operations/templates/database-restore.yaml b/chart/drupal-operations/templates/database-restore.yaml index 699426a..7786e45 100644 --- a/chart/drupal-operations/templates/database-restore.yaml +++ b/chart/drupal-operations/templates/database-restore.yaml @@ -16,7 +16,7 @@ spec: description: The namespace of the drupal site steps: - name: database-restore - image: gitlab-registry.cern.ch/drupal/paas/drupal-operations/openshift-cli:velero-restore + image: {{ .Values.image }} imagePullPolicy: Always command: - /bin/sh -- GitLab