-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
60 lines (56 loc) · 1.41 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
stages:
- test
- docker-publish
- deploy
eslint:
image: node:latest
stage: test
retry: 2
only:
- main
script:
- npm install @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint
- npm run test:lint
sast:
stage: test
retry: 2
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
docker-publish:
image: docker:latest
stage: docker-publish
retry: 2
only:
- main
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY/$CI_PROJECT_PATH${tag}" .
- docker push "$CI_REGISTRY/$CI_PROJECT_PATH${tag}"
deploy:
stage: deploy
image:
name: bitnami/kubectl:latest
entrypoint: ['']
retry: 2
only:
- main
script:
- kubectl config get-contexts
- kubectl config use-context streaks/streaks:streaks
- kubectl config set-context --current --namespace=streaks
- kubectl rollout restart deployment streaks
environment:
name: production
url: https://streaks.chevro.fr