Comment on page
Configure an agent with GitLab
In order to view recipe results and commit changes from a recipe back to GitLab, you'll need to create a GitLab OAuth app and configure the Moderne agent with the appropriate variables.
To assist with that, this guide will:
- You will need administrator access to your organization's GitLab account
- 1.Navigate to the Applications page for your organization:
https://gitlab.com/groups/<yourorg>/-/settings/applications
- 2.Provide an application name and redirect URI. The redirect URI will be in this format:
https://<tenantname>.moderne.io
: *<figure><img src="../../.gitbook/assets/Screenshot 2022-12-27 at 8.59.50 AM.png" alt=""><figcaption></figcaption></figure> - 3.Pick the following scopes: *<figure><img src="../../.gitbook/assets/Screenshot 2022-12-27 at 7.52.35 AM.png" alt=""><figcaption></figcaption></figure>
- 4.Click the Save application button
- 5.Copy the
Application ID
andSecret
from this page; they will be used as arguments for the Moderne Agent: *<figure><img src="../../.gitbook/assets/Screenshot 2022-12-27 at 8.03.35 AM.png" alt=""><figcaption></figcaption></figure>
The following table contains all of the variables/arguments you need to add to your Moderne agent run command in order for it to work with your GitLab instance. Please note that these variables/arguments must be combined with ones found in other steps in the Configuring the Moderne agent guide.
You can configure multiple GitLab OAuth apps by including multiple entries, each with a different
{index}
.OCI Container
Executable JAR
Variables:
MODERNE_AGENT_GITLAB_{index}_OAUTH_CLIENTID
– The application id configured in GitLab.MODERNE_AGENT_GITLAB_{index}_OAUTH_CLIENTSECRET
– The secret configured in GitLab.MODERNE_AGENT_GITLAB_{index}_URL
– The fully-qualified hostname of your GitLab instance.MODERNE_AGENT_BITBUCKET_{index}_SKIPSSL
– (Optional) Specifies whether or not to skip SSL validation for HTTP connections to this GitLab instance. This must be set totrue
if you use a self-signed SSL/TLS certificate. Defaults tofalse
.MODERNE_AGENT_GITLAB_{index}_SSH_PRIVATEKEY
– (Optional) The SSH private key used to establish a SSH connection with GitLab.MODERNE_AGENT_GITLAB_{index}_SSH_PASSPHRASE
– (Required if the SSH private key is specified and encrypted with a passphrase) The passphrase used to encrypt the SSH private key.MODERNE_AGENT_GITLAB_{index}_SSH_SSHFILENAME
– (Required if the SSH private key is specified) The file name of the private key, which the agent will store locally.MODERNE_AGENT_GITLAB_{index}_SSH_USER
– (Required if the SSH private key is specified) The username used for SSH communication with GitLab.MODERNE_AGENT_GITLAB_{index}_SSH_PORT
– (Optional) The port used to communicate via SSH with GitLab. Defaults to7999
.
Example:
docker run \
# ... Existing variables
-e MODERNE_AGENT_GITLAB_0_OAUTH_CLIENTID=yourClientId \
-e MODERNE_AGENT_GITLAB_0_OAUTH_CLIENTSECRET=yourClientSecret \
-e MODERNE_AGENT_GITLAB_0_URL=https://your-gitlab.com \
# ... Additional variables
Arguments:
--moderne.agent.gitlab[{index}].oauth.clientId
– The application id configured in GitLab.--moderne.agent.gitlab[{index}].oauth.clientSecret
– The secret configured in GitLab.--moderne.agent.gitlab[{index}].url
– The fully-qualified hostname of your GitLab instance.--moderne.agent.gitlab[{index}].skipSsl
– (Optional) Specifies whether or not to skip SSL validation for HTTP connections to this GitLab instance. This must be set totrue
if you use a self-signed SSL/TLS certificate. Defaults tofalse
.--moderne.agent.gitlab[{index}].oauth.includePrivateRepos
– (Optional) By default, the OAuth app will only have access to public repositories within your organization(s). To provide the OAuth app access to private repositories, you can set this totrue
.--moderne.agent.gitlab[{index}].ssh.privateKey
– (Optional) The SSH private key used to establish a SSH connection with GitLab.--moderne.agent.gitlab[{index}].ssh.passphrase
– (Required if the SSH private key is specified and encrypted with a passphrase) The passphrase used to encrypt the SSH private key.--moderne.agent.gitlab[{index}].ssh.sshFileName
– (Required if the SSH private key is specified) The file name of the private key, which the agent will store locally.--moderne.agent.gitlab[{index}].ssh.user
– (Required if the SSH private key is specified) The username used for SSH communication with GitLab.--moderne.agent.gitlab[{index}].ssh.port
– (Optional) The port used to communicate via SSH with GitLab. Defaults to7999
.
Example:
java -jar moderne-agent-{version}.jar \
# ... Existing arguments
--moderne.agent.gitlab[0].oauth.clientId=yourClientId \
--moderne.agent.gitlab[0].oauth.clientSecret=yourClientSecret \
--moderne.agent.gitlab[0].url=https://your-gitlab.com \
# ... Additional arguments