Unverified Commit 58a8deb2 authored by Ian Cardoso's avatar Ian Cardoso Committed by GitHub

fix image_scan.sh script and download trivy version (#7950)

parent 3eb4e12c
...@@ -19,9 +19,10 @@ RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget c ...@@ -19,9 +19,10 @@ RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget c
RUN python3 -m pip install awscli RUN python3 -m pip install awscli
RUN TRIVY_VERSION="0.42.0" && \ RUN TRIVY_VERSION="0.43.1" && \
if [ "$(go env GOARCH)" = "arm64" ] || [ "$(go env GOARCH)" = "arm" ]; then \ if [ "$(go env GOARCH)" != "arm" ] && [ "$(go env GOARCH)" != "386" ]; then \
# Turn arm64 and arm into uppercase ARM64 and ARM, respectively, for Trivy's download if [ "$(go env GOARCH)" = "arm64" ]; then \
# Turn arm64 into uppercase ARM64 for Trivy's download
TRIVY_ARCH=$(go env GOARCH | tr "[:lower:]" "[:upper:]") && \ TRIVY_ARCH=$(go env GOARCH | tr "[:lower:]" "[:upper:]") && \
wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" && \ wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" && \
tar -zxvf "trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" && \ tar -zxvf "trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" && \
...@@ -30,6 +31,11 @@ RUN TRIVY_VERSION="0.42.0" ...@@ -30,6 +31,11 @@ RUN TRIVY_VERSION="0.42.0"
wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" && \ wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" && \
tar -zxvf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" && \ tar -zxvf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" && \
mv trivy /usr/local/bin; \ mv trivy /usr/local/bin; \
elif [ "$(go env GOARCH)" = "s390x" ]; then \
wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-s390x.tar.gz" && \
tar -zxvf "trivy_${TRIVY_VERSION}_Linux-s390x.tar.gz" && \
mv trivy /usr/local/bin; \
fi \
fi fi
# this works for both go 1.17 and 1.18 # this works for both go 1.17 and 1.18
......
...@@ -9,8 +9,8 @@ fi ...@@ -9,8 +9,8 @@ fi
ARCH=$2 ARCH=$2
# skipping image scan for s390x since trivy doesn't support s390x arch yet # skipping image scan for 32 bits image since trivy dropped support for those https://github.com/aquasecurity/trivy/discussions/4789
if [ "${ARCH}" == "s390x" ]; then if [[ "${ARCH}" = "arm" ]] || [ "${ARCH}" != "386" ]; then
exit 0 exit 0
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment