Skip to content

[ENG-3025] Support self-hosted GitLab by falling back to available env vars#10

Merged
tphoney merged 1 commit intomainfrom
eng-3025-env0-plugin-support-self-hosted-gitlab-by-constructing-mr
Mar 9, 2026
Merged

[ENG-3025] Support self-hosted GitLab by falling back to available env vars#10
tphoney merged 1 commit intomainfrom
eng-3025-env0-plugin-support-self-hosted-gitlab-by-constructing-mr

Conversation

@DavidS-ovm
Copy link
Member

Summary

  • Fall back to ENV0_TEMPLATE_REPOSITORY when ENV0_PR_SOURCE_REPOSITORY is unavailable (self-hosted GitLab)
  • Fall back to ENV0_VCS_ACCESS_TOKEN when GITLAB_TOKEN is not set
  • Construct a stable MR URL as --ticket-link so Overmind deduplicates changes across multiple plans for the same merge request

Linear Ticket

  • Ticket: ENG-3025 — env0 plugin: support self-hosted GitLab by constructing MR URL from available env vars
  • Purpose: Imperva (Daan) runs env0 against a self-hosted GitLab instance where ENV0_PR_SOURCE_REPOSITORY and GITLAB_TOKEN are not available. This blocks both comment posting and change deduplication.
  • Project: Imperva

Changes

env0.plugin.yaml

Stable ticket-link (lines 216-229): After the existing env0 deployment URL construction, an override builds a stable MR URL from ENV0_PR_SOURCE_REPOSITORY (preferred) or ENV0_TEMPLATE_REPOSITORY (fallback) combined with ENV0_PR_NUMBER. This applies to all actions (submit-plan, start-change, end-change, get-change) and ensures multiple plans for the same MR update the same Overmind change.

GitLab repo + token fallbacks (lines 373-396): Replaced the hard requirements for ENV0_PR_SOURCE_REPOSITORY and GITLAB_TOKEN with graceful fallbacks to ENV0_TEMPLATE_REPOSITORY and ENV0_VCS_ACCESS_TOKEN. Added .git suffix stripping.

GitHub-specific guard (lines 447-450): Moved the ENV0_PR_SOURCE_REPOSITORY check from the common validation path into the github) case block only, since GitLab no longer requires it.

README.md

  • Added "Self-Hosted GitLab" usage section with example YAML
  • Updated "Ticket Links" documentation to describe the new MR URL dedup behavior
  • Updated requirements to note ENV0_TEMPLATE_REPOSITORY as a GitLab fallback
  • Updated GitLab auth docs to mention ENV0_VCS_ACCESS_TOKEN and the api scope requirement

Deviations from Approved Plan

Implementation matches the approved plan — no material deviations.

Parts 2 and 3 from the plan (GitLab repo fallback and token fallback) were combined into a single edit since they are adjacent in the gitlab) case block; the logic is identical to what was specified.

Made with Cursor

Self-hosted GitLab environments lack ENV0_PR_SOURCE_REPOSITORY and
GITLAB_TOKEN. This adds fallbacks so the plugin works out of the box:

- Use ENV0_TEMPLATE_REPOSITORY to derive the GitLab API URL when
  ENV0_PR_SOURCE_REPOSITORY is unavailable
- Accept ENV0_VCS_ACCESS_TOKEN as a fallback for GITLAB_TOKEN
- Construct a stable MR URL as --ticket-link so Overmind deduplicates
  changes across multiple plans for the same merge request
- Strip trailing .git from repository URLs

Made-with: Cursor
@DavidS-ovm DavidS-ovm requested a review from tphoney March 9, 2026 17:19
@tphoney tphoney merged commit 888c231 into main Mar 9, 2026
1 check passed
@tphoney tphoney deleted the eng-3025-env0-plugin-support-self-hosted-gitlab-by-constructing-mr branch March 9, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants