72 lines
1.2 KiB
YAML
72 lines
1.2 KiB
YAML
|
# 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
|
||
|
script:
|
||
|
- command deploy
|
||
|
environment:
|
||
|
name: production
|
||
|
url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
|
||
|
when: manual
|
||
|
only:
|
||
|
- master
|
||
|
|
||
|
staging:
|
||
|
stage: staging
|
||
|
script:
|
||
|
- command deploy
|
||
|
environment:
|
||
|
name: staging
|
||
|
url: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
|
||
|
only:
|
||
|
- master
|
||
|
|
||
|
review:
|
||
|
stage: review
|
||
|
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
|