Raagul L
Raagul L

Reputation: 131

GITLAB CI Pipeline not triggered

I have written this yml file for GitLab CI/CD. There is a shared runner configured and running. I am doing this first time and not sure where I am going wrong. The angular js project I am having on the repo has a gulp build file and works perfectly on local machine. This code just has to trigger that on the vm where my runner is present. On commit the pipeline does not show any job. Let me know what needs to be corrected!

image: docker:latest

cache:
  paths:
    - node_modules/

deploy_stage:
  stage: build
  only:
    - master
  environment: stage
  script:
  - rmdir -rf "build"
  - mkdir "build"
  - cd "build"
  - git init
  - git clone "my url"
  - cd "path of cloned repository"
  - gulp build

Upvotes: 13

Views: 30554

Answers (6)

Слава ЗСУ
Слава ЗСУ

Reputation: 485

Check https://status.gitlab.com for runners services. I had a case when service malfunction were preventing me from running my private runner. You need to wait till all statuses will get back to normal ("Operational" on the language of gitlab)

Upvotes: 1

sagacity
sagacity

Reputation: 349

In my case, I added the .gitlab-ci.yml file directly on the GitLab web page and it was not working. The pipeline was never triggered.

I cloned the code locally, removed the yml file and committed. After adding the file again I committed again and pushed and it worked.

Upvotes: 0

Alex Omosa
Alex Omosa

Reputation: 79

I solved the problem by renaming the .gitlab-ci.yaml to .gitlab-ci.yml

Upvotes: 6

jeff-h
jeff-h

Reputation: 2624

I also had this issue. I thought I would document the cause, in the hopes it may help someone (although this is not strictly an answer for the original question because my deploy script is more complex).

So in my case, the reason was that I had multiple jobs with the same job ID in my .gitlab-ci.yml. The latter one basically rendered the earlier one invisible.


# This job will never run:
deploy_my_stuff:
  script:
    - do something for job one

# This job overwrites the above.
deploy_my_stuff:
  script:
    - do something for job two

Totally obvious... after I discovered the mistake.

Upvotes: 0

walexia
walexia

Reputation: 171

I just wanted to add that I ran into a similar issue. I was committing my code and I was not seeing the pipeline trigger at all.There was also no error statement on gitlab nor in my vscode. It had ran perfectly before.My problem was because I had made some recent edits to my yaml that were invalid.I reverted the changes to a known valid yaml code, and it worked again and passed.

Upvotes: 0

makozaki
makozaki

Reputation: 4366

What branch are you commiting to? You pipeline is configured to run only for commit on master branch.

...
  only:
    - master
...

If you want to have triggered jobs for other branches as well then remove this restriction from .gitlab-ci.yml file.

Do not forget to Enable shared Runners (they may not be enabled by default), setting can be found on GitLab project page under Settings -> CI/CD -> Runners.

Update: Did your pipeline triggers ever work for your project?

If not then I would try configuring simple pipeline just to test if triggers work fine:

test_simple_job:
  script:
    - echo I should execute for any pipeline trigger.

Upvotes: 11

Related Questions