summaryrefslogtreecommitdiff
path: root/vendor/gitlab-ci-yml/autodeploy/Kubernetes.gitlab-ci.yml
blob: c644560647f029cb3b4d21973a284b4fa9078891 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Explanation on the scripts:
# https://gitlab.com/gitlab-examples/kubernetes-deploy/blob/master/README.md
image: registry.gitlab.com/gitlab-examples/kubernetes-deploy

variables:
  # Application deployment domain
  KUBE_DOMAIN: domain.example.com

stages:
  - build
  - test
  - review
  - staging
  - production
  - cleanup

build:
  stage: build
  script:
    - command build
  only:
    - branches

production:
  stage: production
  variables:
    CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
  script:
    - command deploy
  environment:
    name: production
    url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
  when: manual
  only:
    - master

staging:
  stage: staging
  variables:
    CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
  script:
    - command deploy
  environment:
    name: staging
    url: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
  only:
    - master

review:
  stage: review
  variables:
    CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
  script:
    - command deploy
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
    on_stop: stop_review
  only:
    - branches
  except:
    - master

stop_review:
  stage: cleanup
  variables:
    GIT_STRATEGY: none
  script:
    - command destroy
  environment:
    name: review/$CI_COMMIT_REF_NAME
    action: stop
  when: manual
  only:
    - branches
  except:
    - master