Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Update GitLab and Jenkins setup in development documentation #7145

Merged
merged 6 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -346,8 +346,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
44 changes: 26 additions & 18 deletions docs/dev/setup/jenkins-gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,15 @@ both are set up correctly and follow these steps:
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:
email are the same as the user from the database:
reschandreas marked this conversation as resolved.
Show resolved Hide resolved

.. 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 @@ -190,9 +195,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 @@ -327,7 +332,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 @@ -471,7 +476,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 @@ -749,7 +754,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 → Configure*. There you will find the
florian-glombik marked this conversation as resolved.
Show resolved Hide resolved
Timestamper configuration, use the following value for both formats:

::
Expand All @@ -770,16 +775,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 → Plugins*) and install the downloaded file under the
*Advanced* tab under *Deploy Plugin*
reschandreas marked this conversation as resolved.
Show resolved Hide resolved

.. 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 Manage Credentials → Jenkins → Global credentials* and create the
krusche marked this conversation as resolved.
Show resolved Hide resolved
following credentials

GitLab API Token
Expand All @@ -801,7 +806,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 @@ -1018,7 +1023,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 @@ -1076,26 +1082,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 @@ -1228,10 +1236,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.
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.