|
|
|
Create a Jenkins Job
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Creating a Jenkins job for your Gitlab project can be broken into 3 major steps:
|
|
|
|
|
|
|
|
* Create Jenkins Job
|
|
|
|
* Configure Gitlab Project
|
|
|
|
* Add Status Badge to Project
|
|
|
|
|
|
|
|
### Create Jenkins Job
|
|
|
|
|
|
|
|
1. Go to http://ci.digitec.local
|
|
|
|
2. Click [New Job](http://ci.digitec.local/view/All/newJob) in the left sidebar
|
|
|
|
3. Put your (Gitlab) project name as the job name - e.g. `kd-ui`
|
|
|
|
4. Choose **Build a free-style software project**
|
|
|
|
5. Click **OK** button
|
|
|
|
6. Configure **Source Code Management**
|
|
|
|
1. Select **Git**
|
|
|
|
2. Enter your repository URL - e.g. `git@vc.digitec.local:kd/kd-ui.git`
|
|
|
|
3. **Credentials**: `jenkins`
|
|
|
|
4. **Repository browser**: `gitlab`
|
|
|
|
5. Then enter your Gitlab URL - e.g. `https://vc.digitec.local/kd/kd-ui/`
|
|
|
|
6. Grab the Gitlab version from [Gitlab Admin Area](https://vc.digitec.local/admin) and enter it in the **Version** text input - e.g. `6.4.3`
|
|
|
|
7. Under **Build Triggers**, enable **Poll SCM**
|
|
|
|
8. Configure the **Build** section. This varies per project. The following is the build for the `kd-ui` project
|
|
|
|
1. From **Add Build Step** dropdown, chhose **Execute Shell**
|
|
|
|
2. **Commands**:
|
|
|
|
* `npm install`
|
|
|
|
* `grunt jenkins`
|
|
|
|
9. Under **Post-build Actions**, choose **E-mail Notification** from the dropdown
|
|
|
|
* Enable both checkboxes, and make any other modifications you see fit
|
|
|
|
10. Click **Save** button
|
|
|
|
11. Click **Build Now** from the sidebar on the left to confirm that your build runs successfully
|
|
|
|
|
|
|
|
### Configure Gitlab Project
|
|
|
|
|
|
|
|
1. Go to the Settings section of your Gitlab project - e.g. `https://vc.digitec.local/kd/kd-ui-docs/edit`
|
|
|
|
2. Choose the **Web Hooks** link from the left sidebar
|
|
|
|
3. Enter `http://ci.digitec.local/git/notifyCommit?url={GIT PROJECT SSH URL}`, where `{GIT PROJECT SSH URL}` is the SSH URL for your Gitlab project - e.g. `git@vc.digitec.local:kd/kd-ui.git`
|
|
|
|
4. Enable the **Push events** trigger, and click **Add Web Hook**
|
|
|
|
5. The **Test Hook** functionality doesn't appear to be working at the time of this writing, push a change to your Gitlab repository and then check your Jenkins job to verify that it was triggered.
|
|
|
|
|
|
|
|
### Add Status Badge to Project
|
|
|
|
|
|
|
|
Add a Jenkins status badge to your project's `README.md` file, beneath the title, in the following format
|
|
|
|
|
|
|
|
```
|
|
|
|
[![Jenkins]({JENKINS JOB URL}/badge/icon)]({JENKINS JOB URL})
|
|
|
|
```
|
|
|
|
|
|
|
|
Where `{JENKINS JOB URL}` is the URL to your Jenkins job - e.g:
|
|
|
|
|
|
|
|
```
|
|
|
|
[![Jenkins](http://ci.digitec.local/job/kd-ui/badge/icon)](http://ci.digitec.local/job/kd-ui/)
|
|
|
|
``` |
|
|
|
\ No newline at end of file |