debian-mirror-gitlab/doc/development/integrations/jenkins.md

64 lines
2.7 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
2022-11-25 23:54:43 +05:30
stage: Manage
2023-07-09 08:55:56 +05:30
group: Import and Integrate
2022-11-25 23:54:43 +05:30
info: 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
2021-01-29 00:20:46 +05:30
---
2023-03-17 16:20:25 +05:30
# How to run Jenkins in development environment (on macOS)
2020-04-22 19:07:51 +05:30
2020-06-23 00:09:42 +05:30
This is a step by step guide on how to set up [Jenkins](https://www.jenkins.io/) 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.
2020-04-22 19:07:51 +05:30
2021-04-17 20:07:23 +05:30
For configuring an existing Jenkins integration, read [Jenkins CI service](../../integration/jenkins.md).
2020-04-22 19:07:51 +05:30
## Install Jenkins
Install Jenkins and start the service using Homebrew.
```shell
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.
2021-03-11 19:13:27 +05:30
1. Log into your GitLab instance as an administrator.
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Admin**.
2021-11-11 11:23:49 +05:30
1. On the left sidebar, select **Settings > Network**.
2023-05-27 22:25:52 +05:30
1. Expand **Outbound requests**, and select the following checkboxes:
2020-04-22 19:07:51 +05:30
2023-05-27 22:25:52 +05:30
- **Allow requests to the local network from webhooks and integrations**
2020-04-22 19:07:51 +05:30
- **Allow requests to the local network from system hooks**
For more details about GitLab webhooks, see [Webhooks and insecure internal web services](../../security/webhooks.md).
Jenkins uses the GitLab API and needs an access token.
2021-03-11 19:13:27 +05:30
1. Sign in to your GitLab instance.
2022-07-23 23:45:48 +05:30
1. Select your profile picture, then select **Settings**.
1. Select **Access Tokens**.
2020-04-22 19:07:51 +05:30
1. Create a new Access Token with the **API** scope enabled. Note the value of the token.
## Configure Jenkins
2021-04-17 20:07:23 +05:30
To configure your GitLab API connection in Jenkins, read
[Configure the Jenkins server](../../integration/jenkins.md#configure-the-jenkins-server).
2020-04-22 19:07:51 +05:30
## Configure Jenkins Project
2021-04-17 20:07:23 +05:30
To set up the Jenkins project you intend to run your build on, read
[Configure the Jenkins project](../../integration/jenkins.md#configure-the-jenkins-project).
2020-04-22 19:07:51 +05:30
## Configure your GitLab project
2021-04-17 20:07:23 +05:30
You can configure your integration between Jenkins and GitLab:
2020-04-22 19:07:51 +05:30
2022-03-02 08:16:31 +05:30
- With the [recommended approach for Jenkins integration](../../integration/jenkins.md#configure-a-jenkins-integration-recommended).
- [Using a webhook](../../integration/jenkins.md#configure-a-webhook).
2020-04-22 19:07:51 +05:30
## Test your setup
2021-02-22 17:27:13 +05:30
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.