You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The Overmind plugin installs the Overmind CLI (and GitHub CLI) and executes one
8
8
-**submit-plan**: Submits a Terraform plan to Overmind for analysis
9
9
-**start-change**: Marks the beginning of a change in Overmind
10
10
-**end-change**: Marks the completion of a change in Overmind
11
-
-**wait-for-simulation**: Retrieves simulation output from Overmind and comments on the relevant GitHub PR
11
+
-**wait-for-simulation**: Retrieves simulation output from Overmind and comments on the relevant GitHub PR or GitLab MR
12
12
13
13
## Inputs
14
14
@@ -17,7 +17,7 @@ The Overmind plugin installs the Overmind CLI (and GitHub CLI) and executes one
17
17
|`action`| The action to perform. Must be one of: `submit-plan`, `start-change`, `end-change`, `wait-for-simulation`| Yes |
18
18
|`api_key`| Overmind API key for authentication. Must have the following scopes: `account:read`, `changes:write`, `config:write`, `request:receive`, `sources:read`, `source:write`| Yes |
19
19
|`tags`| A comma-separated list of key=value tags to attach to the change (only used with `submit-plan` action) | No |
20
-
|`post_comment`| Whether `wait-for-simulation` should post the Overmind markdown to GitHub. Defaults to `true` when running against a PR, otherwise `false`. | No |
20
+
|`post_comment`| Whether `wait-for-simulation` should post the Overmind markdown to GitHub PR or GitLab MR. Defaults to `true` when running against a PR/MR, otherwise `false`. Automatically detects GitHub or GitLab based on repository URL. | No |
21
21
22
22
## Usage
23
23
@@ -90,7 +90,7 @@ deploy:
90
90
91
91
### Wait for Simulation (any step after Overmind run)
92
92
93
-
Fetch the latest Overmind simulation summary for the current env0 deployment and (optionally) comment on the matching GitHub pull request. By default the plugin posts to GitHub whenever the deployment runs in the context of a PR; set `post_comment: false` to skip commenting. When posting, make sure `GH_TOKEN` is set.
93
+
Fetch the latest Overmind simulation summary for the current env0 deployment and (optionally) comment on the matching GitHub pull request or GitLab merge request. By default the plugin posts comments whenever the deployment runs in the context of a PR/MR; set `post_comment: false` to skip commenting. The plugin automatically detects whether the repository is GitHub or GitLab based on the repository URL. When posting to GitHub, make sure `GH_TOKEN` is set. When posting to GitLab, make sure `GITLAB_TOKEN` is set.
94
94
95
95
```yaml
96
96
version: 2
@@ -139,15 +139,15 @@ deploy:
139
139
140
140
## How It Works
141
141
142
-
1. **Installation**: The plugin automatically installs the latest version of both the Overmind CLI and GitHub CLI to a writable directory in your PATH.
142
+
1. **Installation**: The plugin automatically installs the latest version of the Overmind CLI and GitHub CLI (for GitHub support) to a writable directory in your PATH. GitLab support uses `curl` which is typically available on most systems.
143
143
144
144
2. **Authentication**: The API key provided in the `api_key` input is set as the `OVERMIND_API_KEY` environment variable.
145
145
146
-
3. **Action Execution**: Based on the `action` input, the plugin executes the corresponding Overmind/GitHub workflow:
146
+
3. **Action Execution**: Based on the `action` input, the plugin executes the corresponding Overmind/GitHub/GitLab workflow:
147
147
- `submit-plan`: Uses `$ENV0_TF_PLAN_JSON` to submit the Terraform plan
148
148
- `start-change`: Marks the beginning of a change with a ticket link to the env0 deployment
149
149
- `end-change`: Marks the completion of a change with a ticket link to the env0 deployment
150
-
- `wait-for-simulation`: Retrieves Overmind simulation results as Markdown and (when `post_comment=true`) posts them to the GitHub PR
150
+
- `wait-for-simulation`: Retrieves Overmind simulation results as Markdown and (when `post_comment=true`) posts them to the GitHub PR or GitLab MR (automatically detected based on repository URL)
151
151
152
152
4. **Ticket Links**: All actions automatically construct a ticket link to the env0 deployment using environment variables (`ENV0_PROJECT_ID`, `ENV0_ENVIRONMENT_ID`, `ENV0_DEPLOYMENT_LOG_ID`, `ENV0_ORGANIZATION_ID`).
153
153
@@ -159,7 +159,8 @@ deploy:
159
159
- `ENV0_DEPLOYMENT_LOG_ID`
160
160
- `ENV0_ORGANIZATION_ID`
161
161
- `ENV0_TF_PLAN_JSON`(for submit-plan action)
162
-
- `ENV0_PR_NUMBER`(only when `wait-for-simulation` posts to GitHub, i.e., running against a PR)
162
+
- `ENV0_PR_NUMBER`(only when `wait-for-simulation` posts comments, i.e., running against a PR/MR)
163
+
- `ENV0_PR_SOURCE_REPOSITORY`(only when `wait-for-simulation` posts comments, used to detect GitHub vs GitLab)
163
164
164
165
- A valid Overmind API key with the following required scopes:
165
166
- `account:read`
@@ -170,15 +171,28 @@ deploy:
170
171
- `source:write`
171
172
172
173
- GitHub authentication for the CLI when `wait-for-simulation` posts to GitHub (set `GH_TOKEN`).
174
+
- GitLab authentication when `wait-for-simulation` posts to GitLab (set `GITLAB_TOKEN`).
173
175
174
176
### Creating a `GH_TOKEN`
175
177
176
-
`wait-for-simulation` calls `gh pr comment`, which requires a GitHub personal access token. To create one:
178
+
`wait-for-simulation` calls `gh pr comment` for GitHub repositories, which requires a GitHub personal access token. To create one:
177
179
178
180
1. Sign in to GitHub and open https://github.com/settings/tokens/new (or the fine-grained token wizard).
179
181
2. Choose **Classic** token, set an expiry that matches your security policy, and select the **repo** scope (read/write is needed to comment on PRs).
180
182
3. Generate the token and copy it immediately—GitHub will not show it again.
181
183
4. Store the token securely in env0 (for example as an environment variable or secret) and expose it to the plugin as `GH_TOKEN`.
184
+
185
+
### Creating a `GITLAB_TOKEN`
186
+
187
+
`wait-for-simulation` uses the GitLab API to post comments on merge requests for GitLab repositories. To create a GitLab personal access token:
188
+
189
+
1. Sign in to GitLab and navigate to your user settings (or group/project settings for project/group tokens).
190
+
2. Go to **Access Tokens** (or **Preferences** > **Access Tokens** for user tokens).
191
+
3. Create a new token with the `api` scope (read/write is needed to comment on merge requests).
192
+
4. Generate the token and copy it immediately—GitLab will not show it again.
193
+
5. Store the token securely in env0 (for example as an environment variable or secret) and expose it to the plugin as `GITLAB_TOKEN`.
194
+
195
+
**Note**: The plugin automatically detects whether a repository is GitHub or GitLab based on the `ENV0_PR_SOURCE_REPOSITORY` environment variable. If the repository URL contains "gitlab", it will use GitLab API; otherwise, it will use GitHub CLI.
182
196
## Notes
183
197
184
198
- The plugin automatically detects the operating system and architecture to download the correct Overmind CLI binary.
Copy file name to clipboardExpand all lines: env0.plugin.yaml
+86-16Lines changed: 86 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ inputs:
14
14
description: "The Overmind instance to connect to (defaults to https://app.overmind.tech)"
15
15
required: false
16
16
post_comment:
17
-
description: "Whether wait-for-simulation should post the Overmind markdown to the PR. Defaults to true when ENV0_PR_NUMBER is set, otherwise false."
17
+
description: "Whether wait-for-simulation should post the Overmind markdown to the PR/MR. Defaults to true when ENV0_PR_NUMBER is set, otherwise false. Automatically detects GitHub or GitLab based on repository URL."
18
18
required: false
19
19
run:
20
20
exec: |
@@ -24,6 +24,7 @@ run:
24
24
TMP_DIR=""
25
25
GH_TMP_DIR=""
26
26
MARKDOWN_FILE=""
27
+
JSON_PAYLOAD_FILE=""
27
28
ORIGINAL_DIR=$(pwd)
28
29
29
30
cleanup() {
@@ -36,6 +37,9 @@ run:
36
37
if [ -n "${MARKDOWN_FILE}" ] && [ -f "${MARKDOWN_FILE}" ]; then
37
38
rm -f "${MARKDOWN_FILE}"
38
39
fi
40
+
if [ -n "${JSON_PAYLOAD_FILE}" ] && [ -f "${JSON_PAYLOAD_FILE}" ]; then
41
+
rm -f "${JSON_PAYLOAD_FILE}"
42
+
fi
39
43
}
40
44
trap cleanup EXIT
41
45
@@ -295,7 +299,7 @@ run:
295
299
--ticket-link "${ticket_link}"
296
300
;;
297
301
wait-for-simulation)
298
-
echo "Waiting for Overmind simulation and commenting on PR..."
302
+
echo "Waiting for Overmind simulation and commenting on PR/MR..."
0 commit comments