-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
74 lines (67 loc) · 1.42 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
include:
- project: "devops/gitlab/ci-templates/docker"
ref: "0.0.1"
file:
- ".build_docker_image.yml"
- ".push_docker_image.yml"
- ".remove_docker_image.yml"
- project: "devops/gitlab/ci-templates/sast"
ref: "master"
file:
- ".shiftleft_container_scanning.yml"
- ".trivy_container_scanning.yml"
- template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
stages:
- .pre
- sast
- push
- .post
build_image:
stage: .pre
extends:
- .build_docker_image
variables:
DOCKER_BUILD_CONTEXT: "./files/"
DOCKERFILE_PATH: "./files/"
tags:
- build
shiftleft_container_scanning:
stage: sast
extends:
- .shiftleft_container_scanning
tags:
- build
allow_failure: true
trivy_container_scanning:
stage: sast
extends:
- .trivy_container_scanning
tags:
- build
allow_failure: true
push_latest_image_to_registry:
stage: push
extends:
- .push_docker_image
variables:
IMAGE_TAGS: "${CI_COMMIT_REF_SLUG} ${CI_COMMIT_SHA} ${CI_COMMIT_SHORT_SHA} ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} latest"
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
tags:
- build
push_image_to_registry:
stage: push
extends:
- .push_docker_image
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
tags:
- build
remove_image:
stage: .post
extends:
- .remove_docker_image
rules:
- when: always
tags:
- build