tests: Allow passing pull credentials using IMAGE_PULL_CREDS

To avoid errors when pulling images from docker hub, allow passing
pull credentials using IMAGE_PULL_CREDS.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2021-01-06 12:15:42 -05:00
parent 36840ad3a6
commit 13165f5c88
1 changed files with 5 additions and 2 deletions

View File

@ -159,11 +159,14 @@ failExit() {
}
pullImages() {
if [ -z "$IMAGE_PULL_CREDS" ]; then
echo "Note: Image pull credentials can be passed with env. variable IMAGE_PULL_CREDS=<username>:<password>"
fi
$CTR images rm --sync ${ALPINE_ENC} ${ALPINE_DEC} ${NGINX_ENC} ${NGINX_DEC} &>/dev/null
$CTR images pull --all-platforms ${ALPINE} &>/dev/null
$CTR images pull ${IMAGE_PULL_CREDS:+--user ${IMAGE_PULL_CREDS}} --all-platforms ${ALPINE} &>/dev/null
failExit $? "Image pull failed on ${ALPINE}"
$CTR images pull --platform linux/amd64 ${NGINX} &>/dev/null
$CTR images pull ${IMAGE_PULL_CREDS:+--user ${IMAGE_PULL_CREDS}} --platform linux/amd64 ${NGINX} &>/dev/null
failExit $? "Image pull failed on ${NGINX}"
LAYER_INFO_ALPINE="$($CTR images layerinfo ${ALPINE})"