Skip to content

Commit

Permalink
Development: Update GitLab and Jenkins setup in development documenta…
Browse files Browse the repository at this point in the history
…tion (#7145)
  • Loading branch information
reschandreas authored Sep 22, 2023
1 parent 9e374db commit 5f4e9eb
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/dev/setup/bamboo-bitbucket-jira.rst
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ Configure Artemis
server:
port: 8080 # The port of artemis
url: http://172.20.0.1:8080 # needs to be an ip
// url: http://docker.for.mac.host.internal:8080 # If the above one does not work for mac try this one
// url: http://host.docker.internal:8080 # If the above one does not work for windows try this one
# url: http://docker.for.mac.host.internal:8080 # If the above one does not work for mac try this one
# url: http://host.docker.internal:8080 # If the above one does not work for windows try this one
In addition, you have to start Artemis with the profiles ``bamboo``,
``bitbucket`` and ``jira`` so that the correct adapters will be used,
Expand Down
46 changes: 27 additions & 19 deletions docs/dev/setup/jenkins-gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,16 @@ both are set up correctly and follow these steps:
INSERT INTO `artemis`.`jhi_user_authority` (`user_id`, `authority_name`) VALUES (1,"ROLE_ADMIN");
INSERT INTO `artemis`.`jhi_user_authority` (`user_id`, `authority_name`) VALUES (1,"ROLE_USER");
4. Create a user in Gitlab (``http://your-gitlab-domain/admin/users/new``) and make sure that the username,
email, and password are the same as the user from the database:
4. Create a user in Gitlab (``http://your-gitlab-domain/admin/users/new``) and make sure that the username and
email are the same as the user from the database:

.. figure:: setup/jenkins-gitlab/gitlab_admin_user.png

5. Edit the new admin user (``http://your-gitlab-domain/admin/users/artemis_admin/edit``) to set the password to the
same value as in the database:

.. figure:: setup/jenkins-gitlab/gitlab_admin_user_password.png

Starting the Artemis server should now succeed.

GitLab
Expand Down Expand Up @@ -188,9 +193,9 @@ tokens instead of the predefined ones.

::

docker compose -f docker/<Jenkins setup to be launched>.yml exec gitlab gitlab-rails runner "token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api, :read_user, :read_api, :read_repository, :write_repository, :sudo], name: 'Artemis Admin Token'); token.set_token('artemis-gitlab-token'); token.save!"
docker compose -f docker/<Jenkins setup to be launched>.yml exec gitlab gitlab-rails runner "token = User.find_by_username('root').personal_access_tokens.create(scopes: ['api', 'read_api', 'read_user', 'read_repository', 'write_repository', 'sudo'], name: 'Artemis Admin Token', expires_at: 365.days.from_now); token.set_token('artemis-gitlab-token'); token.save!"

| You can also manually create in by navigating to ``http://localhost:8081/-/profile/personal_access_tokens`` and
| You can also manually create in by navigating to ``http://localhost:8081/-/profile/personal_access_tokens?name=Artemis+Admin+token&scopes=api,read_api,read_user,read_repository,write_repository,sudo`` and
generate a token with all scopes.
| Copy this token into the ``ADMIN_PERSONAL_ACCESS_TOKEN`` field in the
``docker/gitlab/gitlab-local-setup.sh`` file.
Expand Down Expand Up @@ -325,7 +330,7 @@ GitLab Access Token
.. figure:: setup/jenkins-gitlab/gitlab_access_tokens_button.png
:align: center

10. Create a new token named “Artemis” and give it **all** rights.
10. Create a new token named “Artemis” and give it rights ``api``, ``read_api``, ``read_user``, ``read_repository``, ``write_repository``, and ``sudo``.

.. figure:: setup/jenkins-gitlab/artemis_gitlab_access_token.png
:align: center
Expand Down Expand Up @@ -469,7 +474,7 @@ do either do it manually or using the following command:

::

docker compose -f docker/<Jenkins setup to be launched>.yml exec gitlab gitlab-rails runner "token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api, :read_repository], name: 'Jenkins'); token.set_token('jenkins-gitlab-token'); token.save!"
docker compose -f docker/<Jenkins setup to be launched>.yml exec gitlab gitlab-rails runner "token = User.find_by_username('root').personal_access_tokens.create(scopes: ['api', 'read_repository'], name: 'Jenkins', expires_at: 365.days.from_now); token.set_token('jenkins-gitlab-token'); token.save!"



Expand Down Expand Up @@ -746,7 +751,7 @@ Choose “Download now and install after restart” and checking the
Timestamper Configuration
"""""""""""""""""""""""""

Go to *Manage Jenkins → Configure System*. There you will find the
Go to *Manage Jenkins → System Configuration → Configure*. There you will find the
Timestamper configuration, use the following value for both formats:

::
Expand All @@ -767,16 +772,16 @@ JUnit formatted results to any URL.
You can download the current release of the plugin
`here <https://github.com/ls1intum/jenkins-server-notification-plugin/releases>`__
(Download the **.hpi** file). Go to the Jenkins plugin page (*Manage
Jenkins → Manage Plugins*) and install the downloaded file under the
*Advanced* tab under *Upload Plugin*
Jenkins → System Configuration → Plugins*) and install the downloaded file under the
*Advanced settings* tab under *Deploy Plugin*

.. figure:: setup/jenkins-gitlab/jenkins_custom_plugin.png
:align: center

Jenkins Credentials
"""""""""""""""""""

Go to *Manage Jenkins -> Security -> Manage Credentials → Jenkins → Global credentials* and create the
Go to *Manage Jenkins Security Credentials → Jenkins → Global credentials* and create the
following credentials

GitLab API Token
Expand All @@ -798,7 +803,7 @@ GitLab API Token
4. Leave the ID field blank
5. The description is up to you

3. Go to the Jenkins settings *Manage Jenkins → Configure System*. There
3. Go to the Jenkins settings *Manage Jenkins → System*. There
you will find the GitLab settings. Fill in the URL of your GitLab
instance and select the just created API token in the credentials
dropdown. After you click on “Test Connection”, everything should
Expand Down Expand Up @@ -1013,7 +1018,8 @@ You can either run the builds locally (that means on the machine that hosts Jenk
Configuring local build agents
""""""""""""""""""""""""""""""

Go to `Manage Jenkins` > `Manage Nodes and Clouds` > `master`
Go to `Manage Jenkins` → `Nodes` → `Built-In Node` → `Configure`

Configure your master node like this (adjust the number of executors, if needed). Make sure to add the docker label.

.. figure:: setup/jenkins-gitlab/jenkins_local_node.png
Expand Down Expand Up @@ -1071,26 +1077,28 @@ Add agent in Jenkins:

1. Open Jenkins in your browser (e.g. localhost:8082)

2. Go to Manage Jenkins -> Manage Credentials -> (global) -> Add Credentials
2. Go to Manage Jenkins Credentials → System → Global credentials (unrestricted) → Add Credentials

- Kind: SSH Username with private key

- Scope: Global (Jenkins, nodes, items, all child items, etc)

- ID: leave blank

- Description: Up to you

- Username: jenkins

- Private Key: <content of the previous generated private key> (e.g /root/.ssh/id_rsa)
- Private Key: <content of the previously generated private key> (e.g /root/.ssh/id_rsa)

- Passphrase: <the previous entered passphrase> (you can leave it blank if none has been specified)
- Passphrase: <the previously entered passphrase> (you can leave it blank if none has been specified)

.. figure:: setup/jenkins-gitlab/alternative_jenkins_node_credentials.png
:align: center

3. Go to Manage Jenkins -> Manage Nodes and Clouds -> New Node
3. Go to Manage Jenkins Nodes New Node

- Node name: Up to you (e.g. Docker)
- Node name: Up to you (e.g. Docker agent node)

- Check 'Permanent Agent'

Expand Down Expand Up @@ -1223,10 +1231,10 @@ access control in Jenkins.
This enables specific Artemis users to access build plans and execute actions such as triggering a build.
This section explains the changes required in Jenkins in order to set up build plan access control:

1. Navigate to Manage Jenkins -> Manage Plugins -> Installed and make sure that you have the
1. Navigate to Manage Jenkins Plugins Installed plugins and make sure that you have the
`Matrix Authorization Strategy <https://plugins.jenkins.io/matrix-auth/>`__ plugin installed

2. Navigate to Manage Jenkins -> Configure Global Security and navigate to the "Authorization" section
2. Navigate to Manage Jenkins Security and navigate to the "Authorization" section

3. Select the "Project-based Matrix Authorization Strategy" option

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/alternative_jenkins_node_setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/artemis_gitlab_access_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/gitlab_access_tokens_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/gitlab_admin_user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/gitlab_jenkins_token_rights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/gitlab_preferences_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_custom_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_gitlab_configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_local_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_master_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_ssh_credentials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/jenkins_test_project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/dev/setup/jenkins-gitlab/timestamper_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f4e9eb

Please sign in to comment.