-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
148 lines (133 loc) · 3.78 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
image: gitlab.dcso.lolcat:4567/misp/helper-containers:docker
#image: docker:latest
services:
- docker:dind
stages:
- test
- scan
- build
- unsupported
variables:
# The following variables are setup via gitlab project group:
# DOCKER_SLUG
# DOCKER_USERNAME
# DOCKER_PASSWORD
# CUSTOM_REGISTRY_URL
# CUSTOM_REGISTRY_USER
# CUSTOM_REGISTRY_PW
# Set via Job:
# CURRENT_VERSION
# DOCKER_HOST: docker:2376
# DOCKER_TLS_VERIFY: 1
DOCKER_DRIVER: overlay2
#DOCKER_TLS_CERTDIR: ""
before_script:
#- docker info
# Include Variables
- source .ci/00_vars.sh
# Install dependencies
#- .ci/01_before_install.sh
- git config --global user.name "MISP-dockerized-bot"
shellcheck:
stage: test
image: koalaman/shellcheck-alpine
before_script:
- echo "Override default before_script"
script:
- find . -path "*.sh" -type f -print -exec shellcheck {} +
allow_failure: true # If you would check via shellcheck, but not to fail it there is any found.
.env_test_only:
stage: test
tags:
- dind
except:
- master
- dev
- v1.2.0
script:
# Test
- make -C .ci script REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD TEST=no_test VERSION=$CURRENT_VERSION
# Clean Up
- echo "##### clean up..." && make delete
# On dev Branch: Build Environment and Test it with our own Test Framework
.long_test:
stage: test
tags:
- dind
only:
- dev
- v1.2.0
script:
- echo "No task."
# # Test
# - make -C .ci script REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD TEST=long_test VERSION=$CURRENT_VERSION
# # Tag
# - make -C .ci tag REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD
# # Clean Up
# - echo "##### clean up..." && make -C $FOLDER delete
# # https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-reports
# artifacts:
# paths:
# - .ci/reports/*
# reports:
# junit: .ci/reports/*.xml
.push_productive_images:
stage: build
tags:
- dind
only:
- master
- schedules
- v1.2.0
script:
# Test
- make -C .ci script REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD TEST=long_test VERSION=$CURRENT_VERSION
# Tag
- make -C .ci tag REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD
# Push
- make -C .ci push REPOURL=$DOCKER_SLUG USER=$DOCKER_USERNAME PW=$DOCKER_PASSWORD
# Clean Up
- echo "##### clean up..." && make -C $FOLDER delete
# https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-reports
artifacts:
paths:
- ./.ci/reports/*
reports:
junit: ./.ci/reports/*.xml
.container_scanning:
# https://docs.gitlab.com/ee/ci/examples/container_scanning.html
# https://docs.gitlab.com/ee/ci/yaml/README.html#artifactsreportscontainer_scanning
# https://docs.gitlab.com/ee/user/project/merge_requests/container_scanning.html
# https://docs.gitlab.com/ee/ci/yaml/#artifactsreportscontainer_scanning-ultimate
stage: scan
tags:
- dind
variables:
DOCKER_DRIVER: overlay2
## Define two new variables based on GitLab's CI/CD predefined variables
## https://docs.gitlab.com/ee/ci/variables/#predefined-variables-environment-variables
allow_failure: true
script:
- bash .ci/10_scanning.sh
artifacts:
reports:
container_scanning: gl-container-scanning-report.json
include:
- '.gitlab-unsupported.yml'
#- '0.1.0/.gitlab-ci.yml'
#- '0.1.1/.gitlab-ci.yml'
#- '0.1.2/.gitlab-ci.yml'
#- '0.2.0/.gitlab-ci.yml'
#- '0.3.0/.gitlab-ci.yml'
#- '0.3.1/.gitlab-ci.yml'
#- '0.3.2/.gitlab-ci.yml'
#- '0.3.3/.gitlab-ci.yml'
#- '0.3.4/.gitlab-ci.yml'
#- '1.0.0/.gitlab-ci.yml'
#- '1.0.1/.gitlab-ci.yml'
#- '1.0.2/.gitlab-ci.yml'
#- '1.0.3/.gitlab-ci.yml'
- '1.0.4/.gitlab-ci.yml'
#- '1.1.0/.gitlab-ci.yml'
- '1.1.1/.gitlab-ci.yml'
- '1.2.0/.gitlab-ci.yml'