2.7 KiB
stage | group | info |
---|---|---|
Manage | Import and Integrate | To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments |
How to run Jenkins in development environment (on macOS)
This is a step by step guide on how to set up Jenkins on your local machine and connect to it from your GitLab instance. GitLab triggers webhooks on Jenkins, and Jenkins connects to GitLab using the API. By running both applications on the same machine, we can make sure they are able to access each other.
For configuring an existing Jenkins integration, read Jenkins CI service.
Install Jenkins
Install Jenkins and start the service using Homebrew.
brew install jenkins
brew services start jenkins
Configure GitLab
GitLab does not allow requests to localhost or the local network by default. When running Jenkins on your local machine, you need to enable local access.
-
Log into your GitLab instance as an administrator.
-
On the top bar, select Main menu > Admin.
-
On the left sidebar, select Settings > Network.
-
Expand Outbound requests, and select the following checkboxes:
- Allow requests to the local network from webhooks and integrations
- Allow requests to the local network from system hooks
For more details about GitLab webhooks, see Webhooks and insecure internal web services.
Jenkins uses the GitLab API and needs an access token.
- Sign in to your GitLab instance.
- Select your profile picture, then select Settings.
- Select Access Tokens.
- Create a new Access Token with the API scope enabled. Note the value of the token.
Configure Jenkins
To configure your GitLab API connection in Jenkins, read Configure the Jenkins server.
Configure Jenkins Project
To set up the Jenkins project you intend to run your build on, read Configure the Jenkins project.
Configure your GitLab project
You can configure your integration between Jenkins and GitLab:
Test your setup
Make a change in your repository and open an MR. In your Jenkins project it should have triggered a new build and on your MR, there should be a widget saying Pipeline #NUMBER passed. It should also include a link to your Jenkins build.