-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
85 lines (79 loc) · 2.07 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
stages:
- test
- build
build:container:gitlab:
image: docker:20.10.22-dind
stage: build
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: always
- when: never
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:20.10.22-dind
alias: docker
command: ["--tls=false"]
before_script:
- docker info
script:
- echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME || true
- docker build -t $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME .
- docker push $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME
build:container:docker:
image: docker:20.10.22-dind
stage: build
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: always
- when: never
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:20.10.22-dind
alias: docker
command: ["--tls=false"]
before_script:
- docker info
script:
- echo -n $DOCKER_REGISTRY_PASSWORD | docker login -u $DOCKER_REGISTRY_USER --password-stdin
- docker pull $DOCKER_ORG/$DOCKER_PROJECT || true
- docker build -t $DOCKER_ORG/$DOCKER_PROJECT .
- docker push $DOCKER_ORG/$DOCKER_PROJECT
security:iac:
stage: test
allow_failure: true
image:
name: bridgecrew/checkov:latest
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
rules:
- if: $SAST_DISABLED
when: never
- if: $CI_COMMIT_BRANCH
exists:
- '**/*.yml'
- '**/*.yaml'
- '**/*.json'
- '**/*.template'
- '**/*.tf'
- '**/serverless.yml'
- '**/serverless.yaml'
script:
- checkov -d . -o junitxml | tee iac.scan.xml
artifacts:
reports:
junit: "iac.scan.xml"
paths:
- "iac.scan.xml"
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.yml