Skip to content

Commit

Permalink
add task to fail if SM cluster exists
Browse files Browse the repository at this point in the history
  • Loading branch information
bdattoma committed Jan 24, 2025
1 parent fed67d9 commit 2cc5115
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
23 changes: 11 additions & 12 deletions ods_ci/tasks/Resources/Provisioning/Hive/provision.robot
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ Does ClusterName Exists
END
END
ELSE
${anycluster} = Run Keyword And Return Status
... Oc Get kind=ClusterDeployment namespace=${hive_namespace}
... api_version=hive.openshift.io/v1
IF ${anycluster}
${clusterdeploymentname} = Oc Get kind=ClusterDeployment namespace=${hive_namespace}
... api_version=hive.openshift.io/v1 fields=['spec.clusterName']
${clusterdeploymentname}= Set Variable ${clusterdeploymentname}[0][spec.clusterName]
Log ${clusterdeploymentname}
Log ${cluster_name}
IF "${clusterdeploymentname}" == "${cluster_name}"
RETURN True
${rc} ${clusterdeploymentsnames} = Run And Return Rc And Output oc get clusterdeployment -n ${hive_namespace} -ojson | jq '.items[].metadata.name'
Should Be Equal ${rc} ${0}
${clusterdeploymentsnames}= Split To Lines ${clusterdeploymentsnames}
IF len($clusterdeploymentsnames) > 0
FOR ${index} ${cluster_deployment} IN ENUMERATE @{clusterdeploymentsnames}
Log ${index}: ${cluster_deployment}
${cluster_deployment_name}= Set Variable ${cluster_deployment.replace('"','')}
IF "${cluster_deployment_name}" == "${cluster_name}"
RETURN True
END
END
ELSE
Log message=No ClusterDeployment found in ${hive_namespace}.
Log message=No ClusterDeployments found in ${hive_namespace}. console=yes
END
END
RETURN False
Expand Down
7 changes: 7 additions & 0 deletions ods_ci/tasks/Tasks/provision_self_managed_cluster.robot
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ ${artifacts_dir} ${OUTPUT DIR}


*** Tasks ***
Fail If Cluster Exists
[Documentation] Checks if a given cluster exists in Hive
[Tags] self_managed_existence
[Setup] Set ClusterPool Variables
${clustername} = Does ClusterName Exists use_pool=${use_cluster_pool}
Should Be Equal ${clustername} False

Provision Self-Managed Cluster
[Documentation] Provision a self-managed cluster
[Tags] self_managed_provision
Expand Down

0 comments on commit 2cc5115

Please sign in to comment.