-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add managed cluster to framework tests #51057
Merged
openshift-merge-bot
merged 5 commits into
openshift:master
from
dhaiducek:framework-managed
May 23, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
42ccf75
Refactor ClusterPool checkout
dhaiducek 7064489
Bump the builder image in the step registry
dhaiducek ca3ffe4
Add managed cluster to framework tests
dhaiducek a744b48
Manually trigger integration tests
dhaiducek 4a95c19
Enable ClusterPool filtering for ClusterClaims
dhaiducek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 76 additions & 48 deletions
124
...rator/step-registry/ocm/e2e/clusterpool/checkout/ocm-e2e-clusterpool-checkout-commands.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,101 @@ | ||
#!/bin/bash | ||
|
||
log() { | ||
echo "$(date --iso-8601=seconds) ${1}" | ||
} | ||
|
||
checkoutCluster() { | ||
local cluster_type="${1}" | ||
local cluster_idx="${2}" | ||
local pool_filter="${3}" | ||
|
||
local cluster_claim="" | ||
local tmp_claim="${cluster_type}-${cluster_idx}-$suffix" | ||
local filtered_pools="" | ||
filtered_pools="$(echo "${pools}" | grep -e "${pool_filter}")" | ||
|
||
for pool in ${filtered_pools}; do | ||
log "Provisioning claim ${tmp_claim} from ClusterPool ${pool} ..." | ||
make clusterpool/checkout \ | ||
CLUSTERPOOL_NAME=${pool} \ | ||
CLUSTERPOOL_CLUSTER_CLAIM=${tmp_claim} 2>&1 | | ||
sed -u "s/^/${tmp_claim} /" | | ||
tee ${ARTIFACT_DIR}/${pool}_${tmp_claim}-.log | ||
|
||
if [[ "${PIPESTATUS[0]}" == 0 ]]; then | ||
cluster_claim="${tmp_claim}" | ||
break | ||
fi | ||
|
||
log "Claim ${tmp_claim} from ClusterPool ${pool} failed." | ||
done | ||
|
||
if [[ -z "${cluster_claim}" ]]; then | ||
log "No cluster was checked out for ${cluster_type} ${cluster_idx}. Tried these cluster pools:" | ||
echo "${filtered_pools}" | ||
return 1 | ||
fi | ||
|
||
echo "${cluster_claim}" >>"${SHARED_DIR}/${CLUSTER_CLAIM_FILE}" | ||
} | ||
|
||
temp=$(mktemp -d -t ocm-XXXXX) | ||
cd $temp || exit 1 | ||
|
||
cp "$MAKEFILE" ./Makefile | ||
|
||
log "Starting cluster provisioning ..." | ||
|
||
pools="" | ||
if [[ -n "$CLUSTERPOOL_LIST" ]] ; then | ||
if [[ -n "$CLUSTERPOOL_LIST" ]]; then | ||
pools=$(echo "$CLUSTERPOOL_LIST" | tr "," "\n") | ||
elif [[ -f "${SHARED_DIR}/${CLUSTERPOOL_LIST_FILE}" ]] ; then | ||
elif [[ -f "${SHARED_DIR}/${CLUSTERPOOL_LIST_FILE}" ]]; then | ||
pools=$(cat "${SHARED_DIR}/${CLUSTERPOOL_LIST_FILE}") | ||
fi | ||
|
||
if [[ -z "$pools" ]]; then | ||
echo "No pools specified by CLUSTERPOOL_LIST or CLUSTERPOOL_LIST_FILE" | ||
log "No pools specified by CLUSTERPOOL_LIST or CLUSTERPOOL_LIST_FILE" | ||
exit 1 | ||
fi | ||
|
||
suffix=$(cat /dev/urandom | tr -dc "a-z0-9" | head -c 5 ) | ||
pids=() | ||
suffix=$(cat /dev/urandom | tr -dc "a-z0-9" | head -c 5) | ||
|
||
# Checkout hub clusters | ||
for ((i=1;i<=CLUSTERPOOL_HUB_COUNT;i++)); do | ||
cluster_claim="" | ||
for pool in $pools; do | ||
tmp_claim="hub-$i-$suffix" | ||
make clusterpool/checkout \ | ||
CLUSTERPOOL_NAME=$pool \ | ||
CLUSTERPOOL_CLUSTER_CLAIM=$tmp_claim | ||
|
||
if [[ "$?" == 0 ]]; then | ||
cluster_claim="$tmp_claim" | ||
break | ||
fi | ||
done | ||
|
||
if [[ -z "$cluster_claim" ]]; then | ||
echo "No cluster was checked out for hub $i. Tried these cluster pools:" | ||
echo "$pools" | ||
exit 1 | ||
fi | ||
|
||
echo "$cluster_claim" >> "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}" | ||
done | ||
log "Provisioning ${CLUSTERPOOL_HUB_COUNT} hub clusters ..." | ||
if [[ -n "${CLUSTERPOOL_HUB_FILTER}" ]]; then | ||
log "Filtering ClusterPool list using filter: '${CLUSTERPOOL_HUB_FILTER}' ..." | ||
fi | ||
|
||
for ((i = 1; i <= CLUSTERPOOL_HUB_COUNT; i++)); do | ||
checkoutCluster hub ${i} "${CLUSTERPOOL_HUB_FILTER}" & | ||
pids+=($!) | ||
sleep 60 | ||
done | ||
|
||
# Checkout managed clusters | ||
for ((i=1;i<=CLUSTERPOOL_MANAGED_COUNT;i++)); do | ||
cluster_claim="" | ||
for pool in $pools; do | ||
tmp_claim="managed-$i-$suffix" | ||
make clusterpool/checkout \ | ||
CLUSTERPOOL_NAME=$pool \ | ||
CLUSTERPOOL_CLUSTER_CLAIM=$tmp_claim | ||
|
||
if [[ "$?" == 0 ]]; then | ||
cluster_claim="$tmp_claim" | ||
break | ||
fi | ||
done | ||
|
||
if [[ -z "$cluster_claim" ]]; then | ||
echo "No cluster was checked out for managed $i. Tried these cluster pools:" | ||
echo "$pools" | ||
exit 1 | ||
fi | ||
|
||
echo "$cluster_claim" >> "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}" | ||
log "Provisioning ${CLUSTERPOOL_MANAGED_COUNT} managed clusters ..." | ||
if [[ -n "${CLUSTERPOOL_MANAGED_FILTER}" ]]; then | ||
log "Filtering ClusterPool list using filter: '${CLUSTERPOOL_MANAGED_FILTER}' ..." | ||
fi | ||
|
||
for ((i = 1; i <= CLUSTERPOOL_MANAGED_COUNT; i++)); do | ||
checkoutCluster managed ${i} "${CLUSTERPOOL_MANAGED_FILTER}" & | ||
pids+=($!) | ||
sleep 60 | ||
done | ||
|
||
# Wait for background processes to complete and collect exit codes | ||
exit_code=0 | ||
|
||
for pid in "${pids[@]}"; do | ||
wait ${pid} || exit_code=$? | ||
done | ||
|
||
if [[ "${exit_code}" != 0 ]]; then | ||
log "error: claim provisioning failed" | ||
exit ${exit_code} | ||
fi | ||
|
||
echo "Cluster claims:" | ||
log "Cluster claims:" | ||
cat "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the
remaining-required
for?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's a "secondary" job intended to be triggered manually, it can be triggered with
/test remaining-required
(which would also apply to other secondary jobs if we had any).ref: https://docs.ci.openshift.org/docs/how-tos/creating-a-pipeline/#manual-pipelines