I am using GitLab.com, and have a .gitlab-ci.yml file inside my repository that’s configured to run when new tags are added (Using the standard, shared runners). This worked previously when I added new tags, but it seems to have stopped working. After I push a tag to GitLab (git push && git push --tags
), I can see the tag under Repository → Tags in the web interface. However, the pipeline is not started. Manually triggering the pipeline for the tag, gives a ‘reference not found’ error in the web interface (See more details at ‘What I’ve tried’).
My configuration is the following:
build_image:
stage: build
image: docker:20
services:
- docker:20-dind
script:
# First check if the git tag is in the correct format
- "MATCHED_TAG=$(echo $CI_COMMIT_TAG | grep -oE '^([0-9]+\\.){2}[0-9]+')"
- 'if [ -z "$MATCHED_TAG" ]; then echo "ERROR: Invalid tag format, should start with a three part version number (e.g. 1.2.3)" && exit 1; fi'
# Now use the commit tag to create the Docker image tag
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- IMAGE_TAG="$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- 'if docker pull $IMAGE_TAG > /dev/null 2>&1; then echo "ERROR: An image with the given tag already exists. Please increment the contents of the VERSION file" && exit 1; fi'
- docker build . -t $IMAGE_TAG
- docker push $IMAGE_TAG
timeout: 5 minutes
only:
- tags
What I’ve tried:
- Checking the ‘Quotas’ for the group that the repository is in. Both ‘storage’ as well as ‘pipeline’ minutes are not maxed out
- Checking the GitLab system status to see if there are problems on their end, but none were listed (https://status.gitlab.com/)
- Trying to run the pipeline manually (Go to CI/CD → Pipelines, click ‘Run Pipeline’, I select the new tag and click 'Run Pipeline), gives the error
Pipeline cannot be run. Reference not found
in the web interface. Interestingly, I can select older tags, and run the pipeline again for those without a problem. - Checked the ‘compare’ page to see if there as any change to the .gitlab-ci.yml file between the last tag and the current tag. This was not the case.
- Went to ‘CI/CD → Editor’, which inidicated that the syntax of the .gitlab-ci.yml file is correct.
The most important observation seems to bee that when manually triggering the ‘Run Pipeline’ it gives the error ‘Reference not found’. This is interesting, because (1) When select ‘master’, that currently references the same commit, it works (But gives an error that it will not be run, because only: tags is in the CI/CD config), (2) when I select an older tag, it also works. Somehow the new tag (To be specific git tag 2.1.0
) cannot be read by the CI/CD system, even though it’s listed under ‘Repository → Tags’.
Any help would be welcome.