Created
August 1, 2017 17:04
-
-
Save mjudeikis/66bf42229f88236226110614e4bfdc7a to your computer and use it in GitHub Desktop.
imageCache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
yum install -y skopeo | |
if [ ! -f /usr/local/bin/oc ]; then | |
wget https://github.com/openshift/origin/releases/download/v1.4.1/openshift-origin-client-tools-v1.4.1-3f9807a-linux-64bit.tar.gz -O /tmp/oc.tar.gz | |
cd /tmp; tar -zxvf /tmp/oc.tar.gz; cp openshift-origin-client-tools-*/oc /usr/local/bin/ | |
fi | |
oc login -u admin -p admin docker-registry-default.apps.192.168.20.168.xip.io:8443 --insecure-skip-tls-verify=true | |
TOKEN=$(oc whoami -t) | |
docker login docker-registry-default.apps.192.168.20.168.xip.io -u admin -p $TOKEN -e [email protected] | |
#OCP_VERSION="v3.6" | |
OCP_VERSION_LONG="v3.6" | |
#OCP_VERSION_SHORT="v3.6" | |
REGISTRY=brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888 | |
CENTRAL_REGISTRY=docker-registry-default.apps.192.168.20.168.xip.io | |
PROJECT_LIST=( | |
openshift3 | |
jboss-webserver-3 | |
rhscl | |
dotnet | |
library | |
rhel7 | |
ansibleplaybookbundle | |
) | |
CORE_IMAGES=( | |
openshift3/ose-service-catalog | |
openshift3/ose-docker-registry | |
#jboss-webserver-3/webserver30-tomcat7-openshift | |
#jboss-webserver-3/webserver30-tomcat8-openshift | |
#openshift3/image-inspector | |
#openshift3/jenkins-1-rhel7 | |
#openshift3/jenkins-2-rhel7 | |
#logging/metricsimages | |
#openshift3/logging-auth-proxy | |
#openshift3/logging-deployment | |
#openshift3/logging-elasticsearch | |
#openshift3/logging-fluentd | |
#openshift3/logging-kibana | |
#openshift3/logging-curator | |
#openshift3/metrics-cassandra | |
#openshift3/metrics-deployer | |
#openshift3/metrics-hawkular-metrics | |
#openshift3/metrics-heapster | |
#coreimages | |
#openshift3/ose-docker-registry | |
#openshift3/ose-deployer | |
#openshift3/ose-docker-builder | |
#openshift3/ose-docker-registry | |
#openshift3/ose-haproxy-router | |
#openshift3/ose-pod | |
#openshift3/ose-recycler | |
#openshift3/ose-sti-builder | |
) | |
# it was generated by this command from standart ocp cluster | |
# oc get is -n openshift -o yaml | grep "name: registry.access" | awk -F '/' '{print $2"/"$3}' | |
#those are little bit different and version is in NAME itself | |
APP_IMAGES=( | |
openshift3/ansible-service-broker:latest | |
rhel7/etcd:latest | |
#dotnet/dotnetcore-10-rhel7:1.0 | |
#dotnet/dotnetcore-11-rhel7:1.1 | |
#openshift3/jenkins-1-rhel7:latest | |
#openshift3/jenkins-2-rhel7:latest | |
#rhscl/mariadb-101-rhel7:latest | |
#openshift3/mongodb-24-rhel7:latest | |
#rhscl/mongodb-26-rhel7:latest | |
#rhscl/mongodb-32-rhel7:latest | |
#openshift3/mysql-55-rhel7:latest | |
#rhscl/mysql-56-rhel7:latest | |
#rhscl/mysql-57-rhel7:latest | |
#openshift3/nodejs-010-rhel7:latest | |
#rhscl/nodejs-4-rhel7:latest | |
#openshift3/perl-516-rhel7:latest | |
#rhscl/perl-520-rhel7:latest | |
#rhscl/perl-524-rhel7:latest | |
#openshift3/php-55-rhel7:latest | |
#rhscl/php-56-rhel7:latest | |
#rhscl/php-70-rhel7:latest | |
#openshift3/postgresql-92-rhel7:latest | |
#rhscl/postgresql-94-rhel7:latest | |
#rhscl/postgresql-95-rhel7:latest | |
#rhscl/python-27-rhel7:latest | |
#openshift3/python-33-rhel7:latest | |
#rhscl/python-34-rhel7:latest | |
#rhscl/python-35-rhel7:latest | |
#rhscl/redis-32-rhel7:latest | |
#openshift3/ruby-20-rhel7:latest | |
#rhscl/ruby-22-rhel7:latest | |
rhel7/etcd:latest | |
) | |
EXTERNAL_IMAGES=( | |
#centos | |
#library/centos | |
ansibleplaybookbundle/hello-world:latest | |
ansibleplaybookbundle/apb-base:latest | |
ansibleplaybookbundle/s2i-apb:latest | |
ansibleplaybookbundle/py-zip-demo:latest | |
ansibleplaybookbundle/ansible-service-broker:latest | |
ansibleplaybookbundle/pyzip-demo-apb:latest | |
ansibleplaybookbundle/hello-world-apb:latest | |
ansibleplaybookbundle/rhscl-postgresql-apb:latest | |
ansibleplaybookbundle/mediawiki123-apb:latest | |
ansibleplaybookbundle/rhscl-mariadb-apb:latest | |
ansibleplaybookbundle/wordpress-ha-apb:latest | |
ansibleplaybookbundle/jenkins-apb:latest | |
ansibleplaybookbundle/etherpad-apb:latest | |
ansibleplaybookbundle/rocketchat-apb:latest | |
) | |
#create all namespaces | |
## for each namespace | |
for namespespace in "${PROJECT_LIST[@]}"; do | |
oc new-project $namespespace | |
done | |
###############################################import core images | |
for coreimage in "${CORE_IMAGES[@]}"; do | |
## grab a list of available tags | |
tags=$(curl -s http://brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/v1/repositories/${coreimage}/tags | python -c " | |
import json | |
import random | |
import string | |
import sys | |
def key_val(pairs, key): | |
for k in pairs: | |
if k["Key"] == key: | |
return k["Value"] | |
return None | |
j = json.loads(sys.stdin.read()) | |
for r in j: | |
print r | |
") | |
# for each tag | |
for tag in $tags; do | |
## tags with hyphens are skipped as this represent intermediate builds | |
if [[ "$tag" = "${OCP_VERSION_LONG}" ]]; then | |
echo "prefetching $coreimage:$tag" | |
echo "skopeo copy docker://$REGISTRY/$coreimage:$tag atomic:$CENTRAL_REGISTRY/$coreimage:$tag --dest-creds=admin:$TOKEN" | |
skopeo copy docker://$REGISTRY/$coreimage:$tag atomic:$CENTRAL_REGISTRY/$coreimage:$tag --dest-creds=admin:$TOKEN --dest-tls-verify=False --src-tls-verify=False | |
else | |
echo "skipping $coreimage:$tag" | |
echo "skopeo copy docker://$REGISTRY/$coreimage:$tag atomic:$CENTRAL_REGISTRY/$coreimage:$tag --dest-creds=admin:$TOKEN" | |
# skopeo copy docker://$REGISTRY/$coreimage:$tag atomic:$CENTRAL_REGISTRY/$coreimage:$tag --dest-creds=admin:$TOKEN --dest-tls-verify=False --src-tls-verify=False | |
fi | |
done | |
done | |
###############################################import APP images | |
for appimage in "${APP_IMAGES[@]}"; do | |
## grab a list of available tags | |
echo "prefetching $appimage" | |
echo "skopeo copy docker://$REGISTRY/$appimage atomic:$CENTRAL_REGISTRY/$appimage --dest-creds=admin:$TOKEN --dest-tls-verify=false" | |
skopeo copy docker://$REGISTRY/$appimage atomic:$CENTRAL_REGISTRY/$appimage --dest-creds=admin:$TOKEN --dest-tls-verify=false --dest-tls-verify=False --src-tls-verify=False | |
done | |
for extimages in "${EXTERNAL_IMAGES[@]}"; do | |
echo "prefetching $extimages" | |
echo "skopeo copy docker://docker.io/$extimages atomic:$CENTRAL_REGISTRY/$extimages --dest-creds=admin:$TOKEN --dest-tls-verify=false" | |
skopeo copy docker://docker.io/$extimages atomic:$CENTRAL_REGISTRY/$extimages --dest-creds=admin:$TOKEN --dest-tls-verify=false --src-tls-verify --dest-tls-verify=False --src-tls-verify=False | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment