diff --git a/job-images/vcn/Dockerfile b/job-images/vcn/Dockerfile index 97f22a12..29046122 100644 --- a/job-images/vcn/Dockerfile +++ b/job-images/vcn/Dockerfile @@ -1,5 +1,5 @@ -FROM codenotary/vcn:0.9.20 as vcn -FROM docker:20.10.18-dind +FROM codenotary/vcn:v1.0.1 as vcn +FROM alpine:3.16 COPY --from=vcn /bin/vcn /bin/vcn COPY entrypoint.sh / diff --git a/job-images/vcn/entrypoint.sh b/job-images/vcn/entrypoint.sh index f936ee3f..a5c71ff8 100644 --- a/job-images/vcn/entrypoint.sh +++ b/job-images/vcn/entrypoint.sh @@ -1,9 +1,5 @@ #!/bin/bash -echo "Start dockerd in background" -dockerd & -sleep 5 # TODO: Use better wait mechanism - ERRORCOUNT=0 inc_errors() { (( ERRORCOUNT += 1 )) @@ -18,17 +14,17 @@ for img in $(echo "${CONFIG}" | jq -r '.[] | @base64'); do echo "${img}" | base64 -d | jq -r ${1} } - HOST=$(_jq '."registry-host"') USER=$(_jq '."registry-user"') PASSWORD=$(_jq '."registry-password"') IMAGE=$(_jq '."image"') PODS=$(_jq '."pods"') echo "Process image ${IMAGE}" + VCN_PULL_CREDS="" if [ ! -z "${USER}" ] && [ ! -z "${PASSWORD}" ] then - echo "Login to ${HOST}" - docker login -u "${USER}" -p "${PASSWORD}" "${HOST}" + VCN_PULL_CREDS="--image-registry-user ${USER} --image-registry-password ${PASSWORD}" + echo "Using provided pull-credentials" fi # Join Pods, Namespaces and Clusters with "," and form the attributes for notarization. @@ -37,22 +33,10 @@ for img in $(echo "${CONFIG}" | jq -r '.[] | @base64'); do CLUSTER_STRING=$(echo $PODS | jq -r '[.[].cluster] | join(",")') VCN_ATTR="--attr pod=${POD_STRING} --attr namespace=${NAMESPACE_STRING} --attr cluster=${CLUSTER_STRING}" - VCN_ARGS=("${VCN_ATTR}" "${VCN_EXTRA_ARGS:-""}" --bom docker://"${IMAGE}") + VCN_ARGS=("${VCN_PULL_CREDS}" "${VCN_ATTR}" "${VCN_EXTRA_ARGS:-""}" --bom image://"${IMAGE}") - docker pull "${IMAGE}" -q vcn notarize ${VCN_ARGS[@]} - docker rm -f $(docker ps -aq) - docker rmi "${IMAGE}" - - if [ ! -z "${USER}" ] && [ ! -z "${PASSWORD}" ] - then - echo "Logout from ${HOST}" - docker logout "${HOST}" - fi done vcn logout -echo "Kill dockerd" -pkill dockerd - exit $ERRORCOUNT