File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 - Static Code Analysis
1010 - Create Image
1111 - Functional Tests
12+ - Security Scan
1213 - Promote Image
1314
14- image : docker:19.03.8
15+ image : docker:24.0.5
1516
1617.registry_template : ®istry_login
1718 before_script :
@@ -34,10 +35,47 @@ test:
3435 stage : Functional Tests
3536 script : apk add make && cd images/$IMAGE && make test_functional
3637
38+ security_scan_trivy :
39+ services : [ "docker:dind" ]
40+ image :
41+ name : aquasec/trivy:latest
42+ entrypoint : [""]
43+ stage : Security Scan
44+ variables :
45+ GIT_STRATEGY : none
46+ TRIVY_CACHE_DIR : .trivycache/
47+ TRIVY_DEBUG : " true"
48+ TRIVY_EXIT_CODE : 1
49+ TRIVY_FORMAT : json
50+ TRIVY_OUTPUT : gl-container-scanning-report.json
51+ TRIVY_SEVERITY : HIGH,CRITICAL
52+ TRIVY_VULN_TYPE : os,library
53+ script :
54+ - export TAG=bld_$CI_PIPELINE_IID_${CI_COMMIT_SHORT_SHA}
55+ - trivy image --clear-cache
56+ - trivy image --download-db-only --no-progress
57+ - trivy image "${REGISTRY}/${IMAGE}:${TAG}" --severity LOW,MEDIUM
58+ --exit-code 0 --format table --output medium-vulns.txt
59+ - cat medium-vulns.txt
60+ - trivy image "${REGISTRY}/${IMAGE}:${TAG}"
61+ cache :
62+ paths : [ .trivycache ]
63+ interruptible : true
64+ retry :
65+ max : 2
66+ when : [ runner_system_failure, stuck_or_timeout_failure ]
67+ timeout : 5m
68+ artifacts :
69+ reports :
70+ container_scanning : gl-container-scanning-report.json
71+ expire_in : 30 days
72+ paths : [ medium-vulns.txt ]
73+
3774promote_image :
3875 stage : Promote Image
3976 << : *registry_login
4077 script : apk add curl jq make && cd images/$IMAGE && make promote_image
78+ interruptible : true
4179 only :
4280 refs : [ main, tags ]
4381 variables : [ $REGISTRY_URI == "registry.gitlab.com" ]
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ ARG UID=212
2626COPY *.sh /usr/local/bin/
2727RUN apk add --no-cache --update curl dcron git=$GIT_VERSION jq \
2828 openssh-client tzdata && \
29+ apk upgrade libcrypto3 libssl3 && \
2930 addgroup -g $GID $GROUP && \
3031 adduser -u $UID -s /bin/sh -G $GROUP -g "git backup" -D $USERNAME && \
3132 chmod o+rx,g+rx /usr/local/bin/*.sh
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ ENV DEST=. \
1515 GIT_REPO=uri \
1616 INTERVAL=0
1717
18- RUN apk add --no-cache --update git=$GIT_VERSION openssh-client
18+ RUN apk add --no-cache --update git=$GIT_VERSION openssh-client && \
19+ apk upgrade libcrypto3 libssl3
1920VOLUME /git
2021
2122COPY entrypoint.sh /root/
You can’t perform that action at this time.
0 commit comments