-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.gitlab-ci.yml
88 lines (76 loc) · 1.95 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
---
# SPDX-License-Identifier: GPL-3.0-or-later
# (c) 2020-2024 Peter Mosmans [Go Forward]
# Pipeline template for automated security testing
### Variables used throughout the pipeline
variables:
# These variables will be used throughout the pipeline, in all jobs
# Generic cache directory
CACHE_DIR: /srv/cache
# By default, the repository will not be used; artifacts will
GIT_STRATEGY: none
IMAGE_TAG: ${CI_COMMIT_SHORT_SHA}
IMAGE_TAR: ${IMAGE_TAG}.tar
# Tool-specific: Image versions
DEPENDENCY_VERSION: 11.1.1
HADOLINT_VERSION: v2.12.0-debian
NJSSCAN_VERSION: 0.4.3
TOOLS_VERSION: 1.8.0
TRIVY_VERSION: 0.58.1
ZAP_VERSION: 2.15.0
### Include several jobs
include:
# .pre
- .gitlab/detect-secrets.gitlab-ci.yml
# sast
- .gitlab/hadolint.gitlab-ci.yml
# sast
- .gitlab/njsscan.gitlab-ci.yml
# sast
- .gitlab/sonarqube.gitlab-ci.yml
# build
- .gitlab/docker-build.gitlab-ci.yml
# security
- .gitlab/dependency-check.gitlab-ci.yml
# security
- .gitlab/dependency-track.gitlab-ci.yml
# security
- .gitlab/trivy.gitlab-ci.yml
# security
- .gitlab/zap.gitlab-ci.yml
### Pipeline stages
stages:
# Security checks over source code, can be performed parallel to building
- sast
# Build the artifact
- build
# (Dynamic) security checks using / over build artifact
- security
### Jobs
# All jobs that start with a dot are templates and can be extended.
.sast:
stage: sast
# No artifacts from previous stages are required
dependencies: []
# Source code is necessary
variables:
GIT_DEPTH: 1
GIT_STRATEGY: fetch
# Run after the detect-secrets job finishes
needs:
- detect-secrets
.build:
stage: build
# No artifacts from previous stages are required
dependencies: []
# Ensure a "clean" build environment
variables:
GIT_DEPTH: 1
GIT_STRATEGY: clone
# Run after detect-secrets ran successfully
needs:
- detect-secrets
.security:
stage: security
needs:
- build