atkayla
atkayla

Reputation: 8839

How to run GitLab CI pipeline on every push to GitHub?

I created a GitLab "CI/CD for external repo" and linked my GitHub. I then set up mirroring to Pull from that GitHub.

I would have expected when I push to my GitHub, it would show the latest code in the GitLab and automatically start running my GitLab CI pipeline right away, but I noticed this only happens after about 1 hour delay, so I've been pressing the "Update Now" button every time.

This is extremely inconvenient, so am I missing a step to have it simply get the latest code and run the pipeline on every push to GitHub?

Upvotes: 2

Views: 815

Answers (1)

Glen Thomas
Glen Thomas

Reputation: 10744

When mirroring a GitHub repository using GitLabs "CI/CD for external repo" feature, you must use an account with admin access on the GitHub repository so that GitLab can use your credentials to set up a web hook, which will notify GitLab when there are changes to be pulled.

The webhook URL will look like https://gitlab.com/api/v4/projects/12345678/mirror/pull. I don't think you can create this manually as it needs to be set up with a secret, so you probably need to remove the project from GitLab and reconnect it.

Upvotes: 2

Related Questions