Skip to main content

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:

Prerequisites

  • You will need administrator access to your organization's GitLab account

GitLab configuration

Step 1: Create an OAuth application

  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:

  3. Pick the following scopes:

  4. Click the Save application button

  5. Copy the Application ID and Secret from this page; they will be used as arguments for the Moderne Agent:

Agent configuration

Step 2: Configure the Moderne Agent

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}.

Variables:

Variable NameRequiredDefaultDescription
MODERNE_AGENT_GITLAB_{index}_OAUTH_CLIENTIDtrueThe application id configured in GitLab.
MODERNE_AGENT_GITLAB_{index}_OAUTH_CLIENTSECRETtrueThe secret configured in GitLab.
MODERNE_AGENT_GITLAB_{index}_URLtrueThe fully-qualified hostname of your GitLab instance.
MODERNE_AGENT_GITLAB_{index}_SKIPSSLfalsefalseSpecifies whether or not to skip SSL validation for HTTP connections to this GitLab instance. This must be set to true if you use a self-signed SSL/TLS certificate.
MODERNE_AGENT_GITLAB_{index}_SSH_PRIVATEKEYfalseThe SSH private key used to establish a SSH connection with GitLab.
MODERNE_AGENT_GITLAB_{index}_SSH_PASSPHRASEtrue (If the SSH private key is specified)The passphrase used to encrypt the SSH private key.
MODERNE_AGENT_GITLAB_{index}_SSH_SSHFILENAMEtrue (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_USERtrue (If the SSH private key is specified)The username used for SSH communication with GitLab.
MODERNE_AGENT_GITLAB_{index}_SSH_PORTfalse7999The port used to communicate via SSH with GitLab.

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