Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 56 lines (50 sloc) 1.47 KB
#!/bin/sh
#Sample payload
# {
# “docker_url”: “quay.io/cnyanko/webhook-listener”,
# “homepage”: “https://quay.io/repository/cnyanko/webhook-listener“,
# “name”: “webhook-listener”,
# “namespace”: “cnyanko”,
# “repository”: “cnyanko/webhook-listener”,
# “updated_tags”: [
# “latest”
# ]
# }
# Debugging Stuff
echo "~~~~~~~~~~~~~~~~~Payload~~~~~~~~~~~~~~~~~"
echo $1 # Entire Payload
echo "~~~~~~~~~~~~~~~~~Docker URL~~~~~~~~~~~~~~~~~"
echo $2 # Docker URL
echo "~~~~~~~~~~~~~~~~~Updated Tags~~~~~~~~~~~~~~~~~"
echo $3 # Updated Tags
echo "~~~~~~~~~~~~~~~~~Trimmed Tags~~~~~~~~~~~~~~~~~"
trimmedTags=`echo $3 | sed 's/[][]//g'`
echo $trimmedTags
echo "~~~~~~~~~~~~~~~~~Name~~~~~~~~~~~~~~~~~"
echo $4 # Name
echo "~~~~~~~~~~~~~~~~~namespace~~~~~~~~~~~~~~~~~"
echo $5 # namespace
cd /etc/webhook;
AppID=${6/\//\_}
echo $AppID
# Valid stages are develop|build|stage-release|release|operate
Stage="stage_release"
for tag in $trimmedTags ; do
echo "=== testing $tag ==="
if [[ -z "$tag" ]] ; then
echo "Tag invalid"
else
echo "Tag Valid - Doing Scan";
DockerPull=$2:$tag;
echo $DockerPull
# doDockerScan $DockerPull $AppID
docker pull $DockerPull
docker save -o docker.tar $DockerPull
echo 'Should see a docker.tar file'
ls -lah
java -jar nexus-iq-cli.jar -s http://iq-server:8070 -i $AppID -t stage-release -a admin:admin docker.tar
rm docker.tar
docker rmi $DockerPull
ls -lah
fi
done
You can’t perform that action at this time.