-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
122 lines (113 loc) · 2.39 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
stages:
- build
- test
- store
- documentation
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
Buid image:
tags:
- shell
stage: build
script:
- docker build --cache-from $IMAGE_TAG -t $IMAGE_TAG .
cache:
key: ${CI_PIPELINE_ID}
paths:
- node_modules/
Build helm chart:
tags:
- shell
stage: build
only:
- tags
script:
- helm lint helm/beepenmieux
- helm package helm/beepenmieux --app-version $CI_COMMIT_TAG
artifacts:
paths:
- '*.tgz'
Static Code Analysis:
tags:
- docker
image: node:latest
stage: test
script:
- npm install
- npm run lint-no-fix
needs:
- Buid image
Dependency Security Scan:
stage: test
image: node:latest
tags:
- docker
script:
- npm install
- npm audit
needs:
- Buid image
Store docker image:
tags:
- shell
only:
- tags
stage: store
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker tag $IMAGE_TAG ${CI_REGISTRY_IMAGE}:latest
- docker tag $IMAGE_TAG ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- docker push ${CI_REGISTRY_IMAGE}:latest
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
needs:
- Buid image
- Build helm chart
- Static Code Analysis
- Dependency Security Scan
Store staging helm chart:
tags:
- shell
stage: store
only:
- tags
script:
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@beepenmieux-0.1.0.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/staging/charts"'
needs:
- Buid image
- Build helm chart
- Static Code Analysis
- Dependency Security Scan
Store stable helm chart:
tags:
- shell
stage: store
when: manual
only:
- tags
script:
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@beepenmieux-0.1.0.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
needs:
- Buid image
- Build helm chart
- Static Code Analysis
- Dependency Security Scan
pages:
tags:
- docker
stage: documentation
image: node:latest
script:
- npm install
- npm run docs
artifacts:
paths:
- public
only:
- tags
needs:
- Buid image
- Build helm chart
- Static Code Analysis
- Dependency Security Scan
- Store docker image
- Store staging helm chart