chore(): Copy scripts to the container
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
Elia el Lazkani 2023-07-04 19:21:12 +02:00
parent 720bb64266
commit 6efc61c778
3 changed files with 17 additions and 5 deletions

View file

@ -90,7 +90,7 @@ steps:
REGISTRY_PASSWORD:
from_secret: registry_password
commands:
- scripts/get-scan-report.sh "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}"
- scripts/get-scan-report "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}"
- oras tag --username "$REGISTRY_USERNAME" --password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}" latest
when:
event:

View file

@ -3,6 +3,8 @@ MAINTAINER Elia El Lazkani <git@lazkani.io>
ARG ORAS_VERSION="1.0.0"
COPY scripts/* /usr/local/bin/
RUN apk add --virtual .build-deps curl && \
curl -LO "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" && \
mkdir -p oras-install/ && \

View file

@ -14,16 +14,26 @@ printf "Found digests for scan report...\n"
extra_vars=""
if [[ -v REGISTRY_USERNAME ]]
if env | grep REGISTRY_USERNAME > /dev/null;
then
extra_vars="$extra_vars --username $REGISTRY_USERNAME"
fi
if [[ -v REGISTRY_PASSWORD ]]
if env | grep REGISTRY_PASSWORD > /dev/null;
then
extra_vars="$extra_vars --password $REGISTRY_PASSWORD "
fi
image_base=$(echo "$image" | awk -F ':' '{print $1}')
printf "Pulling $image_base:@$report_digest...\n"
oras pull "$extra_vars" "$image_base:@$report_digest"
if [ -e result.json ]; then
rm result.json
fi
oras pull $extra_vars $image_base:@$report_digest
if [ -e result.json ]; then
exit 0
else
exit 1
fi