From 125d7cb9ac46d6b62a5ae30c70c3a72415114e78 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 10 Nov 2022 11:47:20 -0500 Subject: [PATCH] Tag images based on build context For tag-pipelines, tag image with the repo. tag For MR's, tag the image with the MR number For Branches, use the branch name except for `main` use `latest`. Signed-off-by: Chris Evich --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1d4f560..baf1396 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,6 @@ build: /kaniko/executor \ --context $CI_PROJECT_DIR \ --dockerfile $CI_PROJECT_DIR/Containerfile \ - --destination "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:-latest}" \ + --destination "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:-${CI_MERGE_REQUEST_IID:-${CI_COMMIT_BRANCH/main/latest}}}" \ --build-arg "BASE_TAG=$BASE_TAG" \ --build-arg "FLAVOR=$FLAVOR"