DevOps Tools/Integration/Jenkins Gitlab

From r00tedvw.com wiki
Revision as of 15:58, 4 January 2019 by R00t (Talk | contribs)

Jump to: navigation, search

Overview | Continuous Integration (CI) | Source Control Management (SCM) | Containerization | Configuration | Integration

Jenkins with Gitlab

Make sure that you have Jenkins and Gitlab installed.

Configure Gitlab

You will need to have at least (1) project setup, though there doesn't need to be anything in it.

  • Log-in to the Gitlab web portal > [click] Projects > [click] New project > give it:
  • Project Name
  • Description
  • Visibility level (i've chosen private)


Next you'll need to add a deploy key, which is found by:

  • [click] on the project name > go to Settings > [click] Repository > [click] Expand next to Deploy Keys > and define the following:
  • Title - pick a easy description that will help identify it as the public ssh key from your jenkins server
  • Key - Paste the public ssh key from your jenkins server.
  • Write access allowed - make sure to check the box to allow.


Finally you will need to create a Jenkins user on Gitlab and then create a API token to provide Jenkins.

  • First create a new user, in this case I called it Jenkins, and then assign them as a maintainer to the previously created project.
  • Next go to the users Settings > [click] Access Tokens > and define:
  • Name - define a name to easily remember what user this is for.
  • Scopes - I opted to just check api

When you create the access token, it will be displayed on the webpage. NOTE: the api key cannot be recovered after you leave this page. Make sure to copy the key and potentially put it somewhere secure, like a keepass database.

Configure Jenkins

First thing we need to do is give Jenkins a copy of the Private SSH key that was created for the jenkins user on the jenkins server.

  • Log-in to the Jenkins web portal > [click] credentials > [click] system > [click] Global credentials > [click] Add credentials

Obviously you can create a domain for a greater level of security instead of using the unrestricted global credentials group

Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox