ci(action): Security check
Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
parent
fd05c39f00
commit
81028375bc
1 changed files with 17 additions and 1 deletions
18
.github/workflows/workers-ee.yaml
vendored
18
.github/workflows/workers-ee.yaml
vendored
|
|
@ -7,6 +7,10 @@ on:
|
||||||
description: 'Name of a single service to build(in small letters). "all" to build everything'
|
description: 'Name of a single service to build(in small letters). "all" to build everything'
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
skip_security_checks:
|
||||||
|
description: 'Skip Security checks if there is a unfixable vuln or error. Value: true/false'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
|
|
@ -61,6 +65,7 @@ jobs:
|
||||||
#
|
#
|
||||||
set -x
|
set -x
|
||||||
touch /tmp/images_to_build.txt
|
touch /tmp/images_to_build.txt
|
||||||
|
skip_security_checks=${{ github.event.inputs.skip_security_checks }}
|
||||||
tmp_param=${{ github.event.inputs.build_service }}
|
tmp_param=${{ github.event.inputs.build_service }}
|
||||||
build_param=${tmp_param:-'false'}
|
build_param=${tmp_param:-'false'}
|
||||||
case ${build_param} in
|
case ${build_param} in
|
||||||
|
|
@ -89,7 +94,18 @@ jobs:
|
||||||
for image in $(cat /tmp/images_to_build.txt);
|
for image in $(cat /tmp/images_to_build.txt);
|
||||||
do
|
do
|
||||||
echo "Bulding $image"
|
echo "Bulding $image"
|
||||||
PUSH_IMAGE=1 bash -x ./build.sh ee $image
|
PUSH_IMAGE=0 bash -x ./build.sh skip $image
|
||||||
|
[[ "x$skip_security_checks" == "xtrue" ]] || {
|
||||||
|
curl -L https://github.com/aquasecurity/trivy/releases/download/v0.34.0/trivy_0.34.0_Linux-64bit.tar.gz | tar -xzf - -C ./
|
||||||
|
./trivy image --exit-code 1 --vuln-type os,library --severity "HIGH,CRITICAL" --ignore-unfixed $DOCKER_REPO/$image:$IMAGE_TAG
|
||||||
|
err_code=$?
|
||||||
|
[[ $err_code -ne 0 ]] && {
|
||||||
|
exit $err_code
|
||||||
|
}
|
||||||
|
} && {
|
||||||
|
echo "Skipping Security Checks"
|
||||||
|
}
|
||||||
|
PUSH_IMAGE=1 bash -x ./build.sh skip $image
|
||||||
echo "::set-output name=image::$DOCKER_REPO/$image:$IMAGE_TAG"
|
echo "::set-output name=image::$DOCKER_REPO/$image:$IMAGE_TAG"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue