From 91dd4cbaa82f1fc9e30cff4c41c7c4ecb0a8d170 Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Thu, 10 Feb 2022 14:52:20 +0000 Subject: [PATCH] [ci/cd] check tag and not branch master --- .gitlab-ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7d5653..5d74964 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,24 +55,24 @@ build_pypi: paths: - dist/*.whl rules: - - if: '$CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG != ""' + - if: '$CI_COMMIT_TAG != ""' variables: TAG: $CI_COMMIT_TAG build_container: + rules: + - if: '$CI_COMMIT_TAG != ""' + variables: + IMGTAG: $CI_COMMIT_TAG + - if: '$CI_COMMIT_REF_NAME == "devel"' + variables: + IMGTAG: "latest" stage: build image: $CI_REGISTRY/devtools/kaniko script: + - echo "Will upload image halfapi:\"$IMGTAG\"" - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY/malves/halfapi:$TAG + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY/malves/halfapi:"$TAG" artifacts: paths: - /kaniko/.docker/config.json - rules: - - if: '$CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG != ""' - variables: - TAG: $CI_COMMIT_TAG - - if: '$CI_COMMIT_REF_NAME == "devel"' - variables: - TAG: "latest" -