-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
54 lines (47 loc) · 1.13 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
stages:
- create-env
- deploy
- delete-env
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
image: debian
before_script:
- |
if ! command -v task ; then
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update && apt-get -qqy install git curl > /dev/null
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
fi
variables:
VCLUSTER_NAME: $CI_ENVIRONMENT_SLUG
PREVIEW_DOMAIN: $CI_ENVIRONMENT_URL
create-env:
stage: create-env
environment:
name: preview/$CI_MERGE_REQUEST_IID-$CI_COMMIT_REF_SLUG
url: $CI_ENVIRONMENT_SLUG.localhost
action: start
on_stop: delete-env
auto_stop_in: 1 hour
script:
- task create-env
artifacts:
expose_as: kubeconfig
paths:
- kubeconfig.yaml
# deploy-app:
# stage: deploy
# environment:
# name: preview/$CI_MERGE_REQUEST_IID-$CI_COMMIT_REF_SLUG
# action: prepare
# script:
# - task deploy-app
delete-env:
stage: delete-env
when: manual
environment:
name: preview/$CI_MERGE_REQUEST_IID-$CI_COMMIT_REF_SLUG
action: stop
script:
- task delete-env