Skip to main content

GitLab connections

The gitlab connection type represents a GitLab or self-managed GitLab host. It has multiton cardinality and uses the host lookup strategy.

Configure GitLab​

app-config.yaml
connections:
- type: gitlab
host: gitlab.example.com
baseUrl: https://gitlab.example.com
apiBaseUrl: https://gitlab.example.com/api/v4
auth:
- method: token
token: ${GITLAB_TOKEN}

Connection fields​

FieldTypeRequiredDescription
hoststringYesGitLab host matched against the consumer's resource URL.
apiBaseUrlstringNoBase URL for the GitLab API.
baseUrlstringNoBase URL of the GitLab instance.

Authentication methods​

MethodFieldTypeRequiredDescription
noneNone——Does not accept authentication fields.
tokentokenstringYesGitLab access token.

Use none explicitly when the consumer only needs public GitLab content.

Lookup and selection​

The consumer supplies a lookup query containing a GitLab URL. The service selects the connection whose host matches the parsed URL host exactly.

When more than one authentication entry is visible to the calling plugin, the first visible entry is selected. Use plugin scoping to supply a different token to a specific plugin; otherwise, configuration order determines which entry is selected.

Consume a GitLab connection​

const connection = await connections.find({
type: 'gitlab',
query: { url: 'https://gitlab.example.com/acme/example' },
authMethods: ['token', 'none'],
});

connection.apiBaseUrl; // string | undefined

if (connection.auth.method === 'token') {
connection.auth.token; // string
}

Return to the built-in connection type index.