Commit fea6316d authored by Amy Qualls's avatar Amy Qualls

Merge branch '300666-docs-aqualls-ssot' into 'master'

Remove duplicated info from Jenkins dev page

See merge request gitlab-org/gitlab!53913
parents 7f3ad33e a67c62ed
......@@ -8,6 +8,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w
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.
For configuring an existing Jenkins integration, read [Jenkins CI service](../../integration/jenkins.md).
## Install Jenkins
Install Jenkins and start the service using Homebrew.
......@@ -39,62 +41,20 @@ Jenkins uses the GitLab API and needs an access token.
## Configure Jenkins
Configure your GitLab API connection in Jenkins.
1. Make sure the GitLab plugin is installed on Jenkins. You can manage plugins in **Manage Jenkins > Manage Plugins**.
1. Set up the GitLab connection:
1. Go to **Manage Jenkins > Configure System**.
1. Find the **GitLab** section and check the **Enable authentication for '/project' end-point** checkbox.
1. To add your credentials, click **Add** then choose **Jenkins Credential Provider**.
1. Choose **GitLab API token** as the type of token.
1. Paste your GitLab access token and click **Add**.
1. Choose your credentials from the dropdown menu.
1. Add your GitLab host URL. Normally `http://localhost:3000/`.
1. Click **Save Settings**.
For more details, see [GitLab documentation about Jenkins CI](../../integration/jenkins.md).
To configure your GitLab API connection in Jenkins, read
[Configure the Jenkins server](../../integration/jenkins.md#configure-the-jenkins-server).
## Configure Jenkins Project
Set up the Jenkins project to run your build on. A **Freestyle** project is the easiest
option because the Jenkins plugin updates the build status on GitLab. In a **Pipeline** project, updating the status on GitLab needs to be configured in a script.
1. On your Jenkins instance, go to **New Item**.
1. Pick a name, choose **Freestyle** or **Pipeline** and click **ok**.
1. Choose your GitLab connection from the dropdown.
1. Check the **Build when a change is pushed to GitLab** checkbox.
1. Check the following checkboxes:
- **Accepted Merge Request Events**
- **Closed Merge Request Events**
1. If you created a **Freestyle** project, choose **Publish build status to GitLab** in the **Post-build Actions** section.
If you created a **Pipeline** project, updating the status on GitLab has to be done by the pipeline script. Add GitLab update steps as in this example:
```groovy
pipeline {
agent any
stages {
stage('gitlab') {
steps {
echo 'Notify GitLab'
updateGitlabCommitStatus name: 'build', state: 'pending'
updateGitlabCommitStatus name: 'build', state: 'success'
}
}
}
}
```
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).
## Configure your GitLab project
To activate the Jenkins service:
You can configure your integration between Jenkins and GitLab:
1. Go to your project's page, then **Settings > Integrations > Jenkins CI**.
1. Check the **Active** checkbox and the triggers for **Push** and **Merge request**.
1. Fill in your Jenkins host, project name, username and password and click **Test settings and save changes**.
- With the [recommended approach for Jenkins integration](../../integration/jenkins.md#recommended-jenkins-integration).
- [Using a webhook](../../integration/jenkins.md#webhook-integration).
## Test your setup
......
......@@ -31,7 +31,8 @@ the ['GitLab vs. Jenkins' comparison page](https://about.gitlab.com/devops-tools
NOTE:
This documentation focuses only on how to **configure** a Jenkins *integration* with
GitLab. Learn how to **migrate** from Jenkins to GitLab CI/CD in our
GitLab. Learn how to set up Jenkins [on your local machine](../development/integrations/jenkins.md)
in our developer documentation, and how to **migrate** from Jenkins to GitLab CI/CD in our
[Migrating from Jenkins](../ci/migration/jenkins.md) documentation.
## Configure GitLab integration with Jenkins
......@@ -138,9 +139,11 @@ Set up the Jenkins project you intend to run your build on.
## Configure the GitLab project
Configure the GitLab integration with Jenkins.
Configure the GitLab integration with Jenkins in one of the following ways.
### Option 1: Jenkins integration (recommended)
### Recommended Jenkins integration
GitLab recommends this approach for Jenkins integrations.
1. Create a new GitLab project or choose an existing one.
1. Go to **Settings > Integrations**, then select **Jenkins CI**.
......@@ -159,7 +162,7 @@ Configure the GitLab integration with Jenkins.
authentication.
1. Click **Test settings and save changes**. GitLab tests the connection to Jenkins.
### Option 2: Webhook
### Webhook integration
If you are unable to provide GitLab with your Jenkins server login, you can use this option
to integrate GitLab and Jenkins.
......@@ -167,7 +170,8 @@ to integrate GitLab and Jenkins.
1. In the configuration of your Jenkins job, in the GitLab configuration section, click **Advanced**.
1. Click the **Generate** button under the **Secret Token** field.
1. Copy the resulting token, and save the job configuration.
1. In GitLab, create a webhook for your project, enter the trigger URL (such as `https://JENKINS_URL/project/YOUR_JOB`) and paste the token in the **Secret Token** field.
1. In GitLab, create a webhook for your project, enter the trigger URL
(such as `https://JENKINS_URL/project/YOUR_JOB`) and paste the token in the **Secret Token** field.
1. After you add the webhook, click the **Test** button, and it should succeed.
## Troubleshooting
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment