|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +BREW_PASSWORD="" |
| 4 | +QUAY_USERNAME="" |
| 5 | +QUAY_PASSWORD="" |
| 6 | +REDHAT_USERNAME="" |
| 7 | +REDHAT_PASSWORD="" |
| 8 | +OC_USERNAME="kubeadmin" |
| 9 | +OC_PASSWORD="" |
| 10 | +BUILD_VERSION=maistra-2.0-p |
| 11 | +BOOKINFO_NAMESPACE=bookinfo |
| 12 | + |
| 13 | +export REG_CRED="${XDG_RUNTIME_DIR}/containers/auth.json" |
| 14 | + |
| 15 | +#login to brew registry |
| 16 | +podman login --username "|shared-qe-temp.src5.75b4d5" --password $BREW_PASSWORD |
| 17 | +if [ $? != 0 ]; then |
| 18 | + echo "Invalid brew credentials" |
| 19 | + exit 0 |
| 20 | +fi |
| 21 | + |
| 22 | +#login to quay registry |
| 23 | +echo "login to quay registry" |
| 24 | +podman login quay.io --username $QUAY_USERNAME --password $QUAY_PASSWORD |
| 25 | +if [ $? != 0 ]; then |
| 26 | + echo "Invalid quay credentials" |
| 27 | + exit 0 |
| 28 | +fi |
| 29 | + |
| 30 | +#login to redhat registry |
| 31 | +echo "login to redhat registry" |
| 32 | +podman login registry.redhat.io --username $REDHAT_USERNAME --password $REDHAT_PASSWORD |
| 33 | + |
| 34 | +if [[ (-z "$OC_USERNAME") || (-z "$OC_PASSWORD") ]]; then |
| 35 | + read -p "Enter oc cluster username" OC_USERNAME |
| 36 | + read -p "Enter oc cluster password" OC_PASSWORD |
| 37 | +fi |
| 38 | +#login to oc cluster |
| 39 | +oc login -u $OC_USERNAME -p $OC_PASSWORD --insecure-skip-tls-verify |
| 40 | +if [ $? != 0 ]; then |
| 41 | + echo "Invalid credentials" |
| 42 | + exit 0 |
| 43 | +fi |
| 44 | + |
| 45 | +cluster_url=$(oc cluster-info | cut -d$'\n' -f 1| cut -d ' ' -f 6) |
| 46 | +echo "cluster_url $cluster_url" |
| 47 | +OLDIFS=$IFS |
| 48 | +IFS=. |
| 49 | +read -a strarr <<< "$cluster_url" |
| 50 | +IFS=$OLDIFS |
| 51 | +strarr[0]="registry" |
| 52 | +strarr[-1]="io:5000" |
| 53 | + |
| 54 | +local_registry=${strarr[0]} |
| 55 | +for val in "${strarr[@]:1}"; |
| 56 | +do |
| 57 | + local_registry=$local_registry.${val} |
| 58 | +done |
| 59 | +echo "local_registry $local_registry" |
| 60 | + |
| 61 | + |
| 62 | +#login to local registry |
| 63 | +podman login "$local_registry" |
| 64 | + |
| 65 | +cat ${REG_CRED} |
| 66 | + |
| 67 | +#mirroring images |
| 68 | +oc image mirror quay.io/maistra/examples-bookinfo-details-v1:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-details-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 69 | +oc image info $local_registry/maistra/examples-bookinfo-details-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 70 | + |
| 71 | +oc image mirror quay.io/maistra/examples-bookinfo-productpage-v1:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-productpage-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 72 | +oc image info $local_registry/maistra/examples-bookinfo-productpage-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 73 | + |
| 74 | +oc image mirror quay.io/maistra/examples-bookinfo-ratings-v1:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-ratings-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 75 | +oc image info $local_registry/maistra/examples-bookinfo-ratings-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 76 | + |
| 77 | +oc image mirror quay.io/maistra/examples-bookinfo-reviews-v1:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-reviews-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 78 | +oc image info $local_registry/maistra/examples-bookinfo-reviews-v1:2.0.0-ibm-p -a ${REG_CRED} |
| 79 | + |
| 80 | +oc image mirror quay.io/maistra/examples-bookinfo-reviews-v2:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-reviews-v2:2.0.0-ibm-p -a ${REG_CRED} |
| 81 | +oc image info $local_registry/maistra/examples-bookinfo-reviews-v2:2.0.0-ibm-p -a ${REG_CRED} |
| 82 | + |
| 83 | +oc image mirror quay.io/maistra/examples-bookinfo-reviews-v3:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-reviews-v3:2.0.0-ibm-p -a ${REG_CRED} |
| 84 | +oc image info $local_registry/maistra/examples-bookinfo-reviews-v3:2.0.0-ibm-p -a ${REG_CRED} |
| 85 | + |
| 86 | +oc image mirror quay.io/maistra/examples-bookinfo-mongodb:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-mongodb:2.0.0-ibm-p -a ${REG_CRED} |
| 87 | +oc image info $local_registry/maistra/examples-bookinfo-mongodb:2.0.0-ibm-p -a ${REG_CRED} |
| 88 | + |
| 89 | +oc image mirror quay.io/maistra/examples-bookinfo-ratings-v2:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-ratings-v2:2.0.0-ibm-p -a ${REG_CRED} |
| 90 | +oc image info $local_registry/maistra/examples-bookinfo-ratings-v2:2.0.0-ibm-p -a ${REG_CRED} |
| 91 | + |
| 92 | +oc image mirror quay.io/maistra/examples-bookinfo-mysqldb:2.0.0-ibm-p $local_registry/maistra/examples-bookinfo-mysqldb:2.0.0-ibm-p -a ${REG_CRED} |
| 93 | +oc image info $local_registry/maistra/examples-bookinfo-mysqldb:2.0.0-ibm-p -a ${REG_CRED} |
| 94 | + |
| 95 | +oc image mirror quay.io/maistra/governmentpaas-curl-ssl:0.0-ibm-p $local_registry/maistra/governmentpaas-curl-ssl:0.0-ibm-p -a ${REG_CRED} |
| 96 | +oc image info $local_registry/maistra/governmentpaas-curl-ssl:0.0-ibm-p -a ${REG_CRED} |
| 97 | + |
| 98 | +oc image mirror quay.io/maistra/tcp-echo-server:0.0-ibm-p $local_registry/maistra/tcp-echo-server:0.0-ibm-p -a ${REG_CRED} |
| 99 | +oc image info $local_registry/maistra/tcp-echo-server:0.0-ibm-p -a ${REG_CRED} |
| 100 | + |
| 101 | +if [ -d "$HOME/maistra-test-tool" ]; then |
| 102 | + rm -rf "maistra-test-tool" |
| 103 | +fi |
| 104 | + |
| 105 | +# Install Go |
| 106 | +wget https://dl.google.com/go/go1.13.5.linux-ppc64le.tar.gz |
| 107 | +tar -C /usr/local -xzf go1.13.5.linux-ppc64le.tar.gz |
| 108 | +export GOROOT=/usr/local/go |
| 109 | +export GOPATH=$HOME/go |
| 110 | +export PATH=$PATH:$GOROOT/bin:$GOPATH/bin |
| 111 | +rm -rf go1.13.5.linux-ppc64le.tar.gz |
| 112 | +go get github.com/bazelbuild/bazelisk |
| 113 | +export PATH=$PATH:$(go env GOPATH)/bin |
| 114 | +echo "$PATH" |
| 115 | + |
| 116 | +cd $HOME |
| 117 | +git clone https://github.com/maistra/maistra-test-tool/ |
| 118 | +cd maistra-test-tool |
| 119 | +git checkout $BUILD_VERSION |
| 120 | + |
| 121 | +#maistra prerequisite |
| 122 | +chmod +x scripts/setup_ocp_scc_anyuid.sh; |
| 123 | +scripts/setup_ocp_scc_anyuid.sh |
| 124 | + |
| 125 | +cd $HOME/maistra-test-tool/tests |
| 126 | + |
| 127 | +#Replace image registry name with local registry |
| 128 | +sed -i -e "s|quay.io|$local_registry|g" samples/bookinfo/platform/kube/bookinfo-db.yaml |
| 129 | +sed -i -e "s|quay.io|$local_registry|g" samples/bookinfo/platform/kube/bookinfo-mysql.yaml |
| 130 | +sed -i -e "s|quay.io|$local_registry|g" samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml |
| 131 | +sed -i -e "s|quay.io|$local_registry|g" samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml |
| 132 | +sed -i -e "s|quay.io|$local_registry|g" samples/bookinfo/platform/kube/bookinfo.yaml |
| 133 | +sed -i -e "s|quay.io|$local_registry|g" samples/sleep/sleep.yaml |
| 134 | +sed -i -e "s|quay.io|$local_registry|g" samples/tcp-echo/tcp-echo-services.yaml |
| 135 | + |
| 136 | +#To create book info : |
| 137 | +oc new-project ${BOOKINFO_NAMESPACE} || true |
| 138 | +oc project ${BOOKINFO_NAMESPACE} |
| 139 | + |
| 140 | +oc create -f samples/bookinfo/platform/kube/bookinfo.yaml |
| 141 | +oc create -f samples/bookinfo/networking/bookinfo-gateway.yaml |
| 142 | +oc create -f samples/bookinfo/networking/destination-rule-all.yaml |
| 143 | +oc create -f samples/bookinfo/platform/kube/bookinfo-db.yaml |
| 144 | +oc create -f samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml |
| 145 | +oc apply -f samples/bookinfo/platform/kube/bookinfo-db.yaml |
| 146 | +oc apply -f samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml |
| 147 | +oc apply -f samples/bookinfo/platform/kube/bookinfo-mysql.yaml |
| 148 | +oc apply -f samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml |
| 149 | +oc get all |
| 150 | + |
| 151 | +#Run maistra test 01 |
| 152 | +go test -run 01 -timeout 1h -v |
| 153 | + |
0 commit comments