66 lines
1.6 KiB
Bash
Executable File
66 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#$1 - ${{ needs.build-process.outputs.branch }}
|
|
#$2 - ${{ needs.build-process.outputs.org }}
|
|
#$3 - ${{ needs.build-process.outputs.url }}
|
|
#$4 - ${{ needs.build-process.outputs.repo }}
|
|
#$5 - ${{ gitea.workspace }}
|
|
|
|
errors=''
|
|
haserr=false
|
|
for IM in $(ls $5/org/$2/ | xargs)
|
|
do
|
|
echo "image=$IM"
|
|
if test -f $5/org/$2/$IM/test
|
|
then
|
|
test=$(cat $5/org/$2/$IM/test)
|
|
else test=''
|
|
fi
|
|
|
|
echo "test script=$test"
|
|
imgpath="$2/$IM:$1"
|
|
|
|
if [[ $2 == 'k8s' ]]
|
|
then imgpath="$2-$1/$IM:latest"
|
|
fi
|
|
|
|
command="echo empty_command"
|
|
if [[ $test != '' ]]; then
|
|
command="podman run --rm --entrypoint=\"/bin/sh\" $3/$imgpath -c \"$test\""
|
|
else
|
|
if [[ $IM = 'distroless-true' ]]; then
|
|
command="podman run --rm $3/$imgpath \"true\""
|
|
fi
|
|
if [[ $IM = 'distroless-gotop' ]]; then
|
|
command="podman run --rm $3/$imgpath \"--version\""
|
|
fi
|
|
if [[ $IM = 'flannel-cni-plugin' ]]; then
|
|
command="podman run --rm $3/$imgpath \"/flannel\""
|
|
fi
|
|
if [[ $IM = 'pause' ]]; then
|
|
command="podman run --rm $3/$imgpath \"/pause\" \"-v\""
|
|
fi
|
|
fi
|
|
echo $command
|
|
eval $command 2>$IM.log || haserr=true
|
|
|
|
echo "podman rmi --all"
|
|
podman rmi --all
|
|
|
|
if [ "$haserr" = true ]
|
|
then
|
|
if [[ $(cat $IM.log) != '' ]]
|
|
then errors="TEST ERROR OF IMAGE $IM: $(cat $IM.log); $errors"
|
|
else errors="TEST ERROR OF IMAGE $IM: test returned empty error, but exit status was nozero; $errors"
|
|
fi
|
|
fi
|
|
haserr=false
|
|
done
|
|
|
|
echo "$errors"
|
|
if [[ $errors != '' ]]
|
|
then haserr=true
|
|
fi
|
|
echo "ERR=$haserr" > haserr.log
|
|
echo $errors > errors.log
|