From 2821098b406fc6ecedca01cd8e6efdbc440259e2 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 7 Oct 2021 15:54:44 -0400 Subject: [PATCH] .gitlab-ci.yml: Skip main build after stage build Two reasons for this: 1. It's unnecessary, since it's the same ref, so long as we actually build everything as part of the stage job; and 2. In our environment, the token used doesn't have access to pull from the registry. Fixing the latter item can be done at another time. --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6eec7321..aa617608 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,6 +52,7 @@ pages: expire_in: 30 min only: - main + - stage ci:merge: stage: deploy @@ -61,8 +62,9 @@ ci:merge: - git checkout main - git reset --hard origin/main - git merge --ff origin/stage - # This will trigger main pipeline after pushing - - git push http://ci:$STAGE_MERGE_ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git HEAD:main + # Do not trigger the pipeline after pushing; there's no use in + # re-doing the work we just did, since the merge is a fast-forward. + - git push -o ci.skip http://ci:$STAGE_MERGE_ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git HEAD:main only: - stage