-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault_node_pipeline.yml
More file actions
103 lines (91 loc) · 2.56 KB
/
default_node_pipeline.yml
File metadata and controls
103 lines (91 loc) · 2.56 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
include:
- 'https://raw.githubusercontent.com/Timeular/gitlab-templates/master/templates/templates-docker.yml'
- 'https://raw.githubusercontent.com/Timeular/gitlab-templates/master/templates/templates-deploy-to-k8s.yml'
stages:
- test
- build_container
- deploy_to_testing
- deploy_to_production
.template_develop_branch: &develop_branch develop
.template_release_branch: &release_branch /^release\/.*$/
.template_hotfix_branch: &hotfix_branch /^hotfix\/.*$/
.template_build_tags: &build_tags
tags:
- saas-linux-small-amd64
.template_restrict_docker_builds: &restrict_docker_builds
only:
- *hotfix_branch
- *release_branch
- *develop_branch
##
## Test
##
test:static_analysis:
stage: test
image: registry.gitlab.com/timeular/ci/nodejs-base
before_script:
- npm install --silent
script:
- npm run check
<<: *build_tags
##
## Docker
##
build_container:build_and_publish_with_latest:
extends: .docker_build_and_publish_image_with_latest
only:
- *develop_branch
stage: build_container
variables:
CONTEXT_DIR: "."
DOCKERFILE_PATH: "./Dockerfile"
DOCKER_DRIVER: overlay2
<<: *build_tags
build_container:build_and_publish:
extends: .docker_build_and_publish
only:
- *hotfix_branch
- *release_branch
stage: build_container
variables:
CONTEXT_DIR: "."
DOCKERFILE_PATH: "./Dockerfile"
DOCKER_DRIVER: overlay2
<<: *build_tags
##
## Deploy
##
deploy:deploy_to_k8s_testing:
extends: .k8s_vpn_deploy
stage: deploy_to_testing
only:
- *develop_branch
variables:
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE"
DOCKER_TAG_TO_DEPLOY: "$CI_COMMIT_SHA"
VPN_CONFIG: "$TESTING_VPN_CFG"
VPN_CLIENT_CERT: "$TESTING_VPN_CLIENT_CERT_CHAIN"
VPN_CLIENT_KEY: "$TESTING_VPN_CLIENT_CERT_KEY"
K8S_SERVER_NAME: "$TESTING_K8S_SERVER"
K8S_TOKEN: "$TESTING_K8S_DEPLOY_TOKEN"
K8S_CLIENT_CERT: "$TESTING_K8S_CLIENT_CERT"
NAMESPACE: "$K8S_NAMESPACE"
DEPLOYMENT: "$K8S_DEPLOYMENT"
<<: *build_tags
deploy:deploy_to_k8s_production:
extends: .k8s_vpn_deploy
stage: deploy_to_production
when: manual
variables:
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE"
DOCKER_TAG_TO_DEPLOY: "$CI_COMMIT_SHA"
VPN_CONFIG: "$PRODUCTION_VPN_CFG"
VPN_CLIENT_CERT: "$PRODUCTION_VPN_CLIENT_CERT_CHAIN"
VPN_CLIENT_KEY: "$PRODUCTION_VPN_CLIENT_CERT_KEY"
K8S_SERVER_NAME: "$PRODUCTION_K8S_SERVER"
K8S_TOKEN: "$PRODUCTION_K8S_DEPLOY_TOKEN"
K8S_CLIENT_CERT: "$PRODUCTION_K8S_CLIENT_CERT"
NAMESPACE: "$K8S_NAMESPACE"
DEPLOYMENT: "$K8S_DEPLOYMENT"
<<: *build_tags
<<: *restrict_docker_builds