I’m a corporate employee and recently created a GitLab account. I’m encountering an issue where pipelines are automatically triggered every time I push code or create a merge request (MR). My .gitlab-ci.yml file is identical to my teammates’, yet the pipelines only run for my account.
Could anyone please assist me in stopping this automatic pipeline triggering? I’d appreciate any guidance you can provide.
Thank you.
Hi,
Please share your .gitlab-ci.yml
configuration, what is the desired behavior of the pipeline and what have you tried so far.
cache:
paths:
- node_modules/
stages:
- dev_deploy
- prod_deploy
# dev build & deploy
dev_deploy:
stage: dev_deploy
only:
- dev
image: node:20
variables:
SECURE_FILES_DOWNLOAD_PATH: './'
before_script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
script:
- curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
- tar -xf google-cloud-cli-linux-x86_64.tar.gz
- ./google-cloud-sdk/install.sh
- echo $SERVICE_ACCOUNT > /tmp/$CI_PIPELINE_ID.json
- ./google-cloud-sdk/bin/gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
- yarn build:dev
- ./google-cloud-sdk/bin/gcloud --quiet --project $PROJECT_ID app deploy dev.yaml
after_script:
- rm /tmp/$CI_PIPELINE_ID.json
# dev build & deploy
prod_deploy:
stage: prod_deploy
only:
- main
image: node:20
variables:
SECURE_FILES_DOWNLOAD_PATH: './'
before_script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
script:
- curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
- tar -xf google-cloud-cli-linux-x86_64.tar.gz
- ./google-cloud-sdk/install.sh
- echo $SERVICE_ACCOUNT > /tmp/$CI_PIPELINE_ID.json
- ./google-cloud-sdk/bin/gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
- yarn build:prod
- ./google-cloud-sdk/bin/gcloud --quiet --project $PROJECT_ID app deploy prod.yaml
after_script:
- rm /tmp/$CI_PIPELINE_ID.json
This is my current .gitlab-ci.yml
file and I’ve extensively researched this issue, but haven’t found a solution. My pipeline automatically triggers with every code push or merge request, and consistently fails due to a permission error. I’ve just found a temporary workaround: using ci.skip
in my Git commit message to bypass the automatic pipeline triggering.
Is this complete configuration?
And by “pipeline” you mean those two jobs (dev_deploy
and prod_deploy
) - are executing every time you push, even though your branch is not named dev
or main
?
Yes, this is the complete configuration.
And yes, by “pipeline” I mean those two jobs (dev_deploy and prod_deploy). This is probably not the desired behavior.
A pipeline was initiated in GitLab, but it encountered an error (see screenshot). every time I push code. is it related to this config file or something else?
Failed, but we don’t see why. You have to click on the pipeline, and click on the job that failed to see the log and identify the issue.
The .gitlab-ci.yml
configuration you posted - are you sure that that is the content of the file on your branch as well?
If your branch is not named dev
or main
, then there should be no jobs. The only explanation I have is that your branch has different .gitlab-ci.yml
configuration and therefore creating the pipeline.
I’m certain the configuration file I shared is identical to the one in my branch. I’m unsure how, but switching from VS Code to Cursor has resolved the issue, even though everything else remains the same.
BTW thanks for help
1 Like