Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,16 @@ echo "Using region: ${region} resource_group: ${resource_group} vpc: ${vpc_name

"${IBMCLOUD_CLI}" target -g ${resource_group} -r ${region}

echo "DEBUG" "Removing the vpc ${vpc_name}"
echo "DEBUG" "Removing the vpc ${vpc_name} ..."
delete_vpc "${vpc_name}"

echo "DEBUG" "Removing the resource reclamations ..."
if [[ $("${IBMCLOUD_CLI}" resource reclamations -q) == "No reclamation found" ]]; then
echo "No reclamation found"
else
${IBMCLOUD_CLI} resource reclamations -q | awk '(NR>1) {print $1}' | xargs -n1 ibmcloud resource reclamation-delete -f

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When already added -q option, still need (NR>1) in awk ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show me an example output when reclamations are existing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reclamation-delete succeed
the first row is "ID" ( ${IBMCLOUD_CLI} resource reclamations|awk '(NR>3) {print $1}') so got is

Submitting request to delete resource reclamation ID under account fdc2e14cf8bc4d53a67f972dc2e2c861 as ServiceId-dff277a9-b608-410a-ad24-c544e59e3778...
FAILED

fi

echo "DEBUG" "Removing the resource group ${resource_group}"
delCmd="${IBMCLOUD_CLI} resource group-delete -f ${resource_group}"
run_command_with_retries "${delCmd}" 20 20
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ cat > "${SHARED_DIR}/customer_vpc_subnets.yaml" << EOF
platform:
ibmcloud:
resourceGroupName: ${resource_group}
networkResourceGroupName: ${resource_group}
vpcName: ${vpc_name}
networking:
machineNetwork:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,38 @@ set -o errexit
set -o pipefail

CONFIG="${SHARED_DIR}/install-config.yaml"
function getVersion() {
local release_image=""
if [ -n "${RELEASE_IMAGE_INITIAL-}" ]; then
release_image=${RELEASE_IMAGE_INITIAL}
elif [ -n "${RELEASE_IMAGE_LATEST-}" ]; then
release_image=${RELEASE_IMAGE_LATEST}
fi

local version=""
if [ ${release_image} != "" ]; then
oc registry login
version=$(oc adm release info ${release_image} --output=json | jq -r '.metadata.version' | cut -d. -f 1,2)
fi
echo "${version}"
}

version=$(getVersion)
echo "get ocp version: ${version}"
REQUIRED_OCP_VERSION="4.13"
isOldVersion=true
if [ -n "${version}" ] && [ "$(printf '%s\n' "${REQUIRED_OCP_VERSION}" "${version}" | sort --version-sort | head -n1)" = "${REQUIRED_OCP_VERSION}" ]; then
isOldVersion=false
fi

if [ ${isOldVersion} = true ]; then
yq-go d -i "${SHARED_DIR}/customer_vpc_subnets.yaml" 'platform.ibmcloud.networkResourceGroupName'
else
yq-go d -i "${SHARED_DIR}/customer_vpc_subnets.yaml" 'platform.ibmcloud.resourceGroupName'
fi

cat "${SHARED_DIR}/customer_vpc_subnets.yaml"

yq-go m -x -i "${CONFIG}" "${SHARED_DIR}/customer_vpc_subnets.yaml"