-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
127 lines (117 loc) · 2.33 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
123
124
125
126
127
include:
- project: "devops/gitlab/ci-templates/docker"
ref: "0.0.1"
file:
- ".build_docker_image.yml"
- ".push_docker_image.yml"
- ".remove_docker_image.yml"
- ".remove_docker_image_from_registry.yml"
- project: "devops/gitlab/ci-templates/ruby"
ref: "sans-dind"
file:
- ".rspec.yml"
- ".rubocop.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
- push_tmp_image
- test
- sast
- remove_tmp_image
- push
- .post
build_image:
stage: .pre
extends:
- .build_docker_image
tags:
- build
push_tmp_image_to_registry:
stage: push_tmp_image
extends:
- .push_docker_image
needs:
- build_image
variables:
IMAGE_TAGS: ${CI_COMMIT_SHORT_SHA}-${CI_PIPELINE_ID}
tags:
- build
rspec_test:
stage: test
needs:
- push_tmp_image_to_registry
extends:
- .rspec
variables:
RACK_ENV: "test"
tags:
- build
# **Work in Progress**
# rubocop:
# stage: test
# extends:
# - .rubocop
# variables:
# RUBOCOP_DOCKER_ENV_VARS: "--env-file .env"
# before_script:
# - cp ${CI_PROJECT_DIR}/.env.example ${CI_PROJECT_DIR}/.env
# tags:
# - build
shiftleft_container_scanning:
stage: sast
extends:
- .shiftleft_container_scanning
needs:
- push_tmp_image_to_registry
tags:
- build
trivy_container_scanning:
stage: sast
extends:
- .trivy_container_scanning
needs:
- push_tmp_image_to_registry
tags:
- build
allow_failure: true
delete_tmp_image_from_registry:
stage: remove_tmp_image
extends:
- .remove_docker_image_from_registry
rules:
- when: always
needs:
- push_tmp_image_to_registry
- rspec_test
- shiftleft_container_scanning
- trivy_container_scanning
tags:
- build
allow_failure: true
push_image_to_registry:
stage: push
extends:
- .push_docker_image
needs:
- delete_tmp_image_from_registry
- shiftleft_container_scanning
- trivy_container_scanning
- rspec_test
tags:
- build
remove_image:
stage: .post
extends:
- .remove_docker_image
rules:
- when: always
needs:
- build_image
- push_image_to_registry
tags:
- build