Skip to content

Instantly share code, notes, and snippets.

@ethnchao
Last active June 14, 2019 05:58
Show Gist options
  • Save ethnchao/e6364d1b8edddf128c3d93b41803e300 to your computer and use it in GitHub Desktop.
Save ethnchao/e6364d1b8edddf128c3d93b41803e300 to your computer and use it in GitHub Desktop.
sonobuoy test image on Docker
#!/bin/bash
set -o errexit
IMAGE_LIST="gcr.io/google-containers/conformance:v1.14.3
gcr.io/heptio-images/sonobuoy:v0.14.2
gcr.io/kubernetes-e2e-test-images/dnsutils:1.1
gcr.io/kubernetes-e2e-test-images/jessie-dnsutils:1.0
gcr.io/kubernetes-e2e-test-images/mounttest:1.0
gcr.io/kubernetes-e2e-test-images/test-webserver:1.0
gcr.io/heptio-images/sonobuoy-plugin-systemd-logs:latest
gcr.io/kubernetes-e2e-test-images/serve-hostname:1.1
gcr.io/kubernetes-e2e-test-images/liveness:1.1
gcr.io/kubernetes-e2e-test-images/nautilus:1.0
gcr.io/kubernetes-e2e-test-images/netexec:1.1
gcr.io/kubernetes-e2e-test-images/entrypoint-tester:1.0
gcr.io/kubernetes-e2e-test-images/redis:1.0
gcr.io/kubernetes-e2e-test-images/mounttest-user:1.0
quay.io/coreos/etcd:v3.3.10
gcr.io/kubernetes-e2e-test-images/kitten:1.0
gcr.io/kubernetes-e2e-test-images/hostexec:1.1
gcr.io/kubernetes-e2e-test-images/sample-apiserver:1.10
gcr.io/google-samples/gb-redisslave:v3
gcr.io/kubernetes-e2e-test-images/nettest:1.0
gcr.io/kubernetes-e2e-test-images/porter:1.0
gcr.io/google-samples/gb-frontend:v6"
download() {
for image in $IMAGE_LIST
do
registry=$(echo $image | awk -F '/' '{print $1}')
namespace=$(echo $image | awk -F '/' '{print $2}')
name=$(echo $image | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')
tag=$(echo $image | awk -F ':' '{print $2}')
docker pull ethnchao/${namespace}-${name}:${tag}
docker tag ethnchao/${namespace}-${name}:${tag} $image
done
}
upload() {
for image in $IMAGE_LIST
do
registry=$(echo $image | awk -F '/' '{print $1}')
namespace=$(echo $image | awk -F '/' '{print $2}')
name=$(echo $image | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')
tag=$(echo $image | awk -F ':' '{print $2}')
docker pull $image
docker tag $image ethnchao/${namespace}-${name}:${tag}
docker push ethnchao/${namespace}-${name}:${tag}
done
}
delete() {
for image in $IMAGE_LIST
do
registry=$(echo $image | awk -F '/' '{print $1}')
namespace=$(echo $image | awk -F '/' '{print $2}')
name=$(echo $image | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')
tag=$(echo $image | awk -F ':' '{print $2}')
docker rmi $image
docker rmi ethnchao/${namespace}-${name}:${tag}
done
}
ops=$1
if [[ -z $ops ]]; then
echo "$0 download | upload"
exit
fi
case $ops in
"download")
download
;;
"upload")
upload
;;
"delete")
delete
;;
*)
echo "$0 download | upload | delete"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment