GitLab Enterprise Integration
Note
Gitlab Enterprise is only supported on env0 Organizations signed up for our Self-Hosted Agent.
Initial GitLab Enterprise Setup
For env0 to be able to clone your code and post back commit statuses when running Plan on Pull Request you need to provide it with an access token with write permissions.
This only needs to be done once for your Organization.
- Create a Personal access token on your GitLab Enterprise.
- We recommend creating the token for a bot user - as that is the user that will post back commit statuses and comments.
- The user must have access to each repository you would like to be able to use with env0. For each project, the user should have at least Maintainer/Owner permissions.
- The token must have the âread_repositoryâ and "api" scopes defined.
- Encode the personal access token in base64, and use it in the K8S agent installation process as a helm value -
gitlabEnterpriseCredentialsEncoded
. Check out our Self-Hosted K8S agent docs for more information. - Install/update the agent with the new value
New Template
- Click CREATE NEW TEMPLATE on the top right corner of the Templates screen.
- Pick your template type, enter a name for the template, and then click NEXT
- Click the GitLab Enterprise button.
- Enter your repository's HTTPs URL.
- If you would like to pull the code from a specific revision or branch, enter that in the
Revision
field. Leaving this field empty will use your default branch, which is usuallymaster
/main
. - Enter the folder your IaC files are located in under
Terraform Folder
orTerragrunt Folder
. If your IaC files are at the root of the repository, leave this empty. - If you haven't configured env0 Webhooks on this repository before, copy the
Webhook URL
andWebhook Secret
values and paste them on your GitLab Enterprise's repository's settings page. More on that here. - Click NEXT to proceed to the variables section
- Add environment and IaC variables that you'd like to be used during deployment, and then click on NEXT to go to the final "Projects" section
- Pick the projects that you'd like to have access to deploy this template, and then click on DONE to create the template.
Webhooks Integration
Adding Webhooks is required in order to support Continuous Deployment and our Plan on Pull Request features on Gitlab Enterprise.
- Open your repository page in GitLab Enterprise.
- Click on the settings icon.
- Enter the Webhooks page.
- Copy and paste the URL and Secret values from the env0 Template creation page.
- Check the "Push events", "Merge request events" and "Comments" events.
- Click on the "Add webhook" button.
Existing Template
If you would like to integrate an existing template with GitLab Enterprise:
- Go to the Templates screen, and click on Settings for the template you would like to integrate with GitLab Enterprise.
- Click on the VCS step. From there you can click on the GitLab EE button, and integrate with GitLab Enterprise as you would for a new template.
Updated 6 months ago