1- #! /bin/bash
1+ #! /usr/ bin/env bash
22
33set -o pipefail
44
5- mkdir -p installer
5+ OCM_URL= " https://api.stage.openshift.com "
66
7- export VERSION=latest
8- export RELEASE_IMAGE=$( curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION /release.txt | grep ' Pull From: quay.io' | awk -F ' ' ' {print $3}' )
9-
10- export cmd=openshift-install
11- export pullsecret_file=~ /Downloads/crc-pull-secret.txt
12- export extract_dir=$( pwd)
13-
14- if [ -z " $OCM_TOKEN " ]; then
15- echo " Assuming the token should be read from Prow" ;
16- export OCM_TOKEN=$( cat /usr/local/osde2e-credentials/ocm-refresh-token)
7+ if [ -z " ${OCM_TOKEN+x} " ]; then
8+ echo " Assuming the OCM token should be read from Prow" ;
9+ OCM_TOKEN=$( cat /usr/local/osde2e-credentials/ocm-refresh-token)
1710fi
1811
19- if [ -z " AWS_ACCESS_KEY_ID" ]; then
20- export AWS_ACCESS_KEY_ID=$( cat /usr/local/osde2e-credentials/aws-access-key-id)
12+ if [ -z " ${AWS_ACCESS_KEY_ID+x} " ]; then
13+ echo " Assuming the AWS Access token should be read from Prow" ;
14+ AWS_ACCESS_KEY_ID=$( cat /usr/local/osde2e-credentials/aws-access-key-id)
2115fi
2216
23- if [ -z " AWS_SECRET_ACCESS_KEY" ]; then
24- export AWS_SECRET_ACCESS_KEY=$( cat /usr/local/osde2e-credentials/aws-secret-access-key)
17+ if [ -z " ${AWS_SECRET_ACCESS_KEY+x} " ]; then
18+ echo " Assuming the AWS Secret token should be read from Prow" ;
19+ AWS_SECRET_ACCESS_KEY=$( cat /usr/local/osde2e-credentials/aws-secret-access-key)
2520fi
2621
22+ if [ -z " ${PULL_SECRET_FILE+x} " ]; then
23+ echo " Assuming the Pull Secret should be read from Prow" ;
24+ PULL_SECRET_FILE=/usr/local/osde2e-credentials/stage-ocm-pull-secret
25+ fi
2726
28- cp /usr/local/osde2e-credentials/stage-installer-config ./installer/installer-config.yaml
29-
30-
31-
32- curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION /openshift-client-linux.tar.gz | tar zxvf - oc
33-
34- ./oc adm release extract --registry-config " ${pullsecret_file} " --command=$cmd --to " ${extract_dir} " ${RELEASE_IMAGE}
27+ if [ -z " ${INSTALLER_CONFIG+x} " ]; then
28+ echo " Assuming the Installer Config should be read from Prow" ;
29+ INSTALLER_CONFIG=/usr/local/osde2e-credentials/stage-installer-config
30+ fi
3531
36- ./openshift-install create cluster --dir=$( pwd) /installer/ --log-level info
32+ export OCM_CONFIG=./.ocm.json
33+ export KUBECONFIG=" ${SHARED_DIR} /kubeconfig"
3734
38- export OCM_CONFIG=$( pwd) /.ocm.json
39- export KUBECONFIG=$( pwd) /installer/auth/kubeconfig
35+ curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz | tar zxvf - oc
4036
41- {
37+ chmod +x oc
4238
43- go get -u github.com/openshift-online/ocm-cli/cmd/ocm
39+ GO111MODULE=on go get github.com/openshift-online/ocm-cli/cmd/ocm@master
4440
45- if [ -z " $OCM_URL " ]; then
46- ocm login --token=$ OCM_TOKEN
41+ if [ -z " ${ OCM_URL} " ]; then
42+ ocm login --token=" ${ OCM_TOKEN} "
4743else
48- ocm login --url=$OCM_URL --token=$OCM_TOKEN
44+ ocm login --url=" ${OCM_URL} " --token=" ${OCM_TOKEN} "
45+ fi
4946
50- cat << EOF | oc create -n openshift-monitoring -f -
47+ cat << EOF | ./ oc create -n openshift-monitoring -f -
5148apiVersion: v1
5249kind: ConfigMap
5350metadata:
54- name: cluster-monitoring-config
55- namespace: openshift-monitoring
51+ name: cluster-monitoring-config
52+ namespace: openshift-monitoring
5653data:
57- config.yaml: |
54+ config.yaml: |
5855 telemeterClient:
59- telemeterServerURL: https://infogw.api.stage.openshift.com
60-
56+ telemeterServerURL: https://infogw.api.stage.openshift.com
6157EOF
62- sleep 600;
63- echo " Output new config"
64- oc get -n openshift-monitoring configmap/cluster-monitoring-config -o yaml
65- fi
6658
67- COUNT=$( CLUSTER_ID=$( oc get clusterversion -o jsonpath=' {.items[].spec.clusterID}{"\n"}' ) ; ocm get clusters --parameter search=" external_id is '$CLUSTER_ID '" | jq ' .size' )
59+ sleep 600;
60+ echo " Output new config"
61+ ./oc get -n openshift-monitoring configmap/cluster-monitoring-config -o yaml
62+
63+ COUNT=$( CLUSTER_ID=$( ./oc get clusterversion -o jsonpath=' {.items[].spec.clusterID}{""}' ) ; ocm get clusters --parameter search=" external_id is '${CLUSTER_ID} '" | jq ' .size' )
6864
6965if [[ " $COUNT " == " 0" ]]; then
7066 echo " No cluster found!" ;
7167 exit 1
7268else
7369 echo " Cluster found!" ;
7470 exit 0
75- fi
76-
77- } 2>&1 | tee -a /tmp/artifacts/test_output.log
71+ fi
0 commit comments