Skip to content
Snippets Groups Projects
Commit fcbdfd61 authored by (INACTIVE) Marcel Bajdel (new marcel.bajdel)'s avatar (INACTIVE) Marcel Bajdel (new marcel.bajdel) :rocket:
Browse files

fixing check_image_tag

parent 6de812e5
No related branches found
No related tags found
3 merge requests!20Release,!13Docker image branch,!12Docker image branch
......@@ -47,29 +47,27 @@ branch_scan:
when: on_success
expire_in: 10 minutes
check_image_tag: # Check whether the image is already existing or not for the tag
check_image_tag:
stage: check_image_tag
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
script:
- cd tar_images
- >
for tar_image in *.tar; do
file_name="${tar_image%.*}"
vulnerabilities=$(awk -F '[:,]' '/"Vulnerabilities"/ {gsub("[[:blank:]]+", "", $2); print $2}' "../scan_result/$file_name.json")
if [ -n "$vulnerabilities" ]; then
echo "There are security issues with the image $img.Dockerfile. Image is not pushed to registry!"
echo "Vulnerabilities found in $img.Dockerfile are: $vulnerabilities" > docker_latest_image.txt
crane validate --tarball "$file_name"
echo "false" > docker_latest_image.txt
exit 1
else
echo "There are no security issues with the image $img.Dockerfile."
crane validate --tarball "$file_name"
echo "true" > docker_latest_image.txt
fi
done
- file_name=${CI_COMMIT_REF_NAME} # Assuming you want to use the branch name
- vulnerabilities=$(awk -F '[:,]' '/"Vulnerabilities"/ {gsub("[[:blank:]]+", "", $2); print $2}' "../scan_result/${file_name}.json")
- |
if [ -n "$vulnerabilities" ]; then
echo "There are security issues with the image ${file_name}.Dockerfile. Image is not pushed to registry!"
echo "Vulnerabilities found in ${file_name}.Dockerfile are: $vulnerabilities" > docker_latest_image.txt
crane validate --tarball "$file_name.tar"
echo "false" > docker_latest_image.txt
exit 1
else
echo "There are no security issues with the image ${file_name}.Dockerfile."
crane validate --tarball "$file_name.tar"
echo "true" > docker_latest_image.txt
fi
artifacts:
paths:
- docker_latest_image.txt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment