Creating an Integration
You can add this integration by following steps on the Managing Pipelines Integrations page.
Here is the information you need to create this integration:
- Name -- choose a friendly name for the integration
- URL -- location of your GitLab API. The URL should be in the format
https://(GitLab URL)/api/(api version)
. For example, if you're using gitlab.com, this will behttps://gitlab.com/api/v4
. Please note that if you're using Gitlab version 9.0 or later, you should usev4
for api version. If you're using Gitlab version 8.17 or earlier, you should usev3
for api version. API v3 is unsupported from Gitlab 9.5 according to this Gitlab notice Token -- GitLab private token with the right levels of permission
Token Permissions
To use this integration as a pipeline source, your token must be granted these scopes at minimum:
- api
- write_repository
Additionally, if your organization uses SAML single sign-on, and you want your tokens to work with the SAML, you will have to configure it.
Usage
The GitLab integration can be used in the GitRepo resource.
The GitLab integration can also be added directly to a step in the integrations
section.
Default Environment Variables
When you create a resource with this integration, and create a step that uses it, a set of environment variables is automatically made available.
Environment variable | Description |
---|---|
res_<resource-name>_gitProvider_url | GitLab API location |
res_<resource-name>_gitProvider_token | The token used to connect to GitLab |
When you add this integration directly to a step, a set of environment variables is automatically made available.
Environment variable | Description |
---|---|
name_<integration-name>_url | GitLab API location |
name_<integration-name> _token | The Token used to connect to GitLab |