@@ -219,10 +219,17 @@ You can also specify a static part of the URL at `environment:url:`, such as
...
@@ -219,10 +219,17 @@ You can also specify a static part of the URL at `environment:url:`, such as
The assigned URL for the `review/your-branch-name` environment is [visible in the UI](#using-the-environment-url).
The assigned URL for the `review/your-branch-name` environment is [visible in the UI](#using-the-environment-url).
> **Notes:**
Note the following:
>
> - `stop_review` doesn't generate a dotenv report artifact, so it won't recognize the `DYNAMIC_ENVIRONMENT_URL` variable. Therefore you should not set `environment:url:` in the `stop_review` job.
-`stop_review` doesn't generate a dotenv report artifact, so it won't recognize the
> - If the environment URL is not valid (for example, the URL is malformed), the system doesn't update the environment URL.
`DYNAMIC_ENVIRONMENT_URL` variable. Therefore you shouldn't set `environment:url:` in the
`stop_review` job.
- If the environment URL isn't valid (for example, the URL is malformed), the system doesn't update
the environment URL.
- If the script that runs in `stop_review` exists only in your repository and therefore can't use
`GIT_STRATEGY: none`, configure [pipelines for merge requests](../../ci/merge_request_pipelines/index.md)
for these jobs. This ensures that runners can fetch the repository even after a feature branch is
deleted. For more information, see [Ref Specs for Runners](../pipelines/index.md#ref-specs-for-runners).
### Configuring manual deployments
### Configuring manual deployments
...
@@ -675,24 +682,23 @@ deploy_review:
...
@@ -675,24 +682,23 @@ deploy_review:
name:review/$CI_COMMIT_REF_NAME
name:review/$CI_COMMIT_REF_NAME
url:https://$CI_ENVIRONMENT_SLUG.example.com
url:https://$CI_ENVIRONMENT_SLUG.example.com
on_stop:stop_review
on_stop:stop_review
only:
rules:
-branches
-if:$CI_MERGE_REQUEST_ID
except:
-master
stop_review:
stop_review:
stage:deploy
stage:deploy
variables:
GIT_STRATEGY:none
script:
script:
-echo "Remove review app"
-echo "Remove review app"
when:manual
environment:
environment:
name:review/$CI_COMMIT_REF_NAME
name:review/$CI_COMMIT_REF_NAME
action:stop
action:stop
rules:
-if:$CI_MERGE_REQUEST_ID
when:manual
```
```
Setting the [`GIT_STRATEGY`](../yaml/README.md#git-strategy) to `none` is necessary in the
If you can't use [Pipelines for merge requests](../merge_request_pipelines/index.md),
setting the [`GIT_STRATEGY`](../yaml/README.md#git-strategy) to `none` is necessary in the
`stop_review` job so that the [runner](https://docs.gitlab.com/runner/) won't
`stop_review` job so that the [runner](https://docs.gitlab.com/runner/) won't
try to check out the code after the branch is deleted.
try to check out the code after the branch is deleted.
When a runner picks a pipeline job, GitLab provides that job's metadata. This includes the [Git refspecs](https://git-scm.com/book/en/v2/Git-Internals-The-Refspec),
which indicate which ref (branch, tag, and so on) and commit (SHA1) are checked out from your
project repository.
This table lists the refspecs injected for each pipeline type:
| Pipeline for Branches | `+refs/pipelines/<id>:refs/pipelines/<id>` and `+refs/heads/<name>:refs/remotes/origin/<name>` |
| pipeline for Tags | `+refs/pipelines/<id>:refs/pipelines/<id>` and `+refs/tags/<name>:refs/tags/<name>` |
| [Pipeline for Merge Requests](../merge_request_pipelines/index.md) | `+refs/pipelines/<id>:refs/pipelines/<id>` |
The refs `refs/heads/<name>` and `refs/tags/<name>` exist in your
project repository. GitLab generates the special ref `refs/pipelines/<id>` during a
running pipeline job. This ref can be created even after the associated branch or tag has been
deleted. It's therefore useful in some features such as [automatically stopping an environment](../environments/index.md#automatically-stopping-an-environment),
and [merge trains](../merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md)
that might run pipelines after branch deletion.
### View pipelines
### View pipelines
You can find the current and historical pipeline runs under your project's
You can find the current and historical pipeline runs under your project's