Skip to content

Commit a7eb643

Browse files
authored
Minor updates to ci-e2e.sh (kubernetes-sigs#2471)
1 parent 87be6f7 commit a7eb643

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

hack/boskos.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -o pipefail
2020

2121
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222

23-
USER="cluster-api-provider-ibmcloud"
23+
USER=${USER:-"cluster-api-provider-ibmcloud"}
2424

2525
release_account(){
2626
url="http://${BOSKOS_HOST}/release?name=${BOSKOS_RESOURCE_NAME}&dest=dirty&owner=${USER}"
@@ -43,12 +43,13 @@ checkout_account(){
4343

4444
if [[ ${status_code} == 200 ]]; then
4545
export BOSKOS_RESOURCE_NAME=$(jq -r '.name' < output.json)
46-
export IBMCLOUD_API_KEY=$(jq -r '.userdata["api-key"]' < output.json)
47-
export BOSKOS_RESOURCE_GROUP=$(jq -r '.userdata["resource-group"]' < output.json)
4846
export BOSKOS_REGION=$(jq -r '.userdata["region"]' < output.json)
49-
if [[ ${resource_type} == "powervs-service" ]]; then
50-
export BOSKOS_RESOURCE_ID=$(jq -r '.userdata["service-instance-id"]' < output.json)
47+
api_key=$(jq -er '.userdata["api-key"]' < output.json 2>/dev/null) && export IBMCLOUD_API_KEY="$api_key"
48+
if [[ ${resource_type} =~ "powervs" ]]; then
49+
export BOSKOS_SERVICE_INSTANCE_ID=$(jq -r '.userdata["service-instance-id"]' < output.json)
5150
export BOSKOS_ZONE=$(jq -r '.userdata["zone"]' < output.json)
51+
elif [[ ${resource_type} =~ "vpc" ]]; then
52+
export BOSKOS_RESOURCE_GROUP=$(jq -r '.userdata["resource-group"]' < output.json)
5253
fi
5354
rm -rf output.json
5455
else

scripts/ci-e2e.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ create_powervs_network_instance(){
9696
ibmcloud pi workspace target ${CRN}
9797

9898
# Create the network instance
99-
${capibmadm} powervs network create --name ${IBMPOWERVS_NETWORK_NAME} --dns-servers 1.1.1.1,8.8.8.8,9.9.9.9 --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${ZONE}
99+
${capibmadm} powervs network create --name ${IBMPOWERVS_NETWORK_NAME} --dns-servers 1.1.1.1,8.8.8.8,9.9.9.9 --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${IBMPOWERVS_ZONE}
100100

101101
}
102102

@@ -107,10 +107,10 @@ init_network_powervs(){
107107
create_powervs_network_instance
108108

109109
# Creating PowerVS network port
110-
${capibmadm} powervs port create --network ${IBMPOWERVS_NETWORK_NAME} --description "capi-e2e" --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${ZONE}
110+
${capibmadm} powervs port create --network ${IBMPOWERVS_NETWORK_NAME} --description "capi-e2e" --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${IBMPOWERVS_ZONE}
111111

112112
# Get and assign the IPs to the required variables
113-
NEW_PORT=$(${capibmadm} powervs port list --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${ZONE} --network ${IBMPOWERVS_NETWORK_NAME} -o json)
113+
NEW_PORT=$(${capibmadm} powervs port list --service-instance-id ${IBMPOWERVS_SERVICE_INSTANCE_ID} --zone ${IBMPOWERVS_ZONE} --network ${IBMPOWERVS_NETWORK_NAME} -o json)
114114
no_of_ports=$(echo ${NEW_PORT} | jq '.items | length')
115115
if [[ ${no_of_ports} != 1 ]]; then
116116
echo "Failed to get the required number or ports, got - ${no_of_ports}"
@@ -125,9 +125,8 @@ prerequisites_powervs(){
125125
# Assigning PowerVS variables
126126
export IBMPOWERVS_SSHKEY_NAME=${IBMPOWERVS_SSHKEY_NAME:-"powercloud-bot-key"}
127127
export IBMPOWERVS_IMAGE_NAME=${IBMPOWERVS_IMAGE_NAME:-"capibm-powervs-centos-streams9-1-33-1"}
128-
export IBMPOWERVS_SERVICE_INSTANCE_ID=${BOSKOS_RESOURCE_ID:-"d53da3bf-1f4a-42fa-9735-acf16b1a05cd"}
128+
export IBMPOWERVS_SERVICE_INSTANCE_ID=${BOSKOS_SERVICE_INSTANCE_ID:-"d53da3bf-1f4a-42fa-9735-acf16b1a05cd"}
129129
export IBMPOWERVS_NETWORK_NAME="capi-net-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head --bytes 5)"
130-
export ZONE=${BOSKOS_ZONE:-"osa21"}
131130
export IBMPOWERVS_REGION=${BOSKOS_REGION:-"osa"}
132131
export IBMPOWERVS_ZONE=${BOSKOS_ZONE:-"osa21"}
133132
init_network_powervs

0 commit comments

Comments
 (0)