-
Notifications
You must be signed in to change notification settings - Fork 40
OCPNETUI-56: Add hot-cluster E2E workflows, composite actions, and Dockerfile.ci #497
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
Open
lkladnit
wants to merge
1
commit into
openshift:main
Choose a base branch
from
lkladnit:lkladnit/hot-cluster-workflows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .git | ||
| node_modules | ||
| dist | ||
| .idea | ||
| .vscode | ||
| .devcontainer | ||
| .github | ||
| ci-scripts | ||
| ui-tests-cy | ||
| integration-tests | ||
| problem | ||
| .env | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Release CI Test Environment | ||
| description: > | ||
| Signal the ci-env-controller to tear down a test environment by patching | ||
| the trigger ConfigMap to desired-state=absent, then wait for cleanup to | ||
| complete and delete the ConfigMap. | ||
|
|
||
| inputs: | ||
| configmap-name: | ||
| description: Name of the trigger ConfigMap | ||
| required: true | ||
| ci-env-namespace: | ||
| description: Namespace where ci-env-controller runs | ||
| default: ci-env | ||
| timeout: | ||
| description: Max seconds to wait for cleanup to complete | ||
| default: '300' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Release environment | ||
| shell: bash | ||
| env: | ||
| CM_NAME: ${{ inputs.configmap-name }} | ||
| CM_NS: ${{ inputs.ci-env-namespace }} | ||
| TIMEOUT: ${{ inputs.timeout }} | ||
| run: | | ||
| if ! oc get configmap "${CM_NAME}" -n "${CM_NS}" &>/dev/null; then | ||
| echo "ConfigMap ${CM_NS}/${CM_NAME} not found, nothing to clean up." | ||
| exit 0 | ||
| fi | ||
|
|
||
| oc patch configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| --type merge -p '{"data":{"desired-state":"absent"}}' | ||
|
|
||
| echo "Waiting for controller to clean up..." | ||
| INTERVAL=5 | ||
| ELAPSED=0 | ||
|
|
||
| while true; do | ||
| STATUS="$(oc get configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| -o jsonpath='{.data.status}' 2>/dev/null || echo "")" | ||
|
|
||
| if [[ "${STATUS}" == "cleaned" ]]; then | ||
| echo "Cleanup complete." | ||
| break | ||
| fi | ||
|
|
||
| if (( ELAPSED >= TIMEOUT )); then | ||
| echo "::warning::Timed out waiting for controller cleanup (status=${STATUS})" | ||
| break | ||
| fi | ||
|
|
||
| sleep "${INTERVAL}" | ||
| ELAPSED=$(( ELAPSED + INTERVAL )) | ||
| done | ||
|
|
||
| oc delete configmap "${CM_NAME}" -n "${CM_NS}" 2>/dev/null || true |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| name: Request CI Test Environment | ||
| description: > | ||
| Create a trigger ConfigMap for the ci-env-controller and wait until the | ||
| test environment (namespace, console, plugin) is provisioned and ready. | ||
|
|
||
| inputs: | ||
| plugin-image: | ||
| description: Plugin container image to deploy | ||
| required: true | ||
| test-namespace: | ||
| description: Kubernetes namespace for the test environment | ||
| required: true | ||
| configmap-name: | ||
| description: Name of the trigger ConfigMap | ||
| required: true | ||
| ci-env-namespace: | ||
| description: Namespace where ci-env-controller runs | ||
| default: ci-env | ||
| timeout: | ||
| description: Max seconds to wait for environment to become ready | ||
| default: '360' | ||
|
|
||
| outputs: | ||
| bridge-base-address: | ||
| description: In-cluster URL for the console bridge | ||
| value: ${{ steps.wait.outputs.bridge-base-address }} | ||
| console-route: | ||
| description: External HTTPS route for the console | ||
| value: ${{ steps.wait.outputs.console-route }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Create trigger ConfigMap | ||
| shell: bash | ||
| run: | | ||
| cat <<EOF | oc create -f - | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: ${{ inputs.configmap-name }} | ||
| namespace: ${{ inputs.ci-env-namespace }} | ||
| labels: | ||
| ci.networking-console-plugin/type: test-environment | ||
| data: | ||
| desired-state: "present" | ||
| plugin-image: "${{ inputs.plugin-image }}" | ||
| test-namespace: "${{ inputs.test-namespace }}" | ||
| EOF | ||
| echo "Created trigger ConfigMap ${{ inputs.configmap-name }} in ${{ inputs.ci-env-namespace }}" | ||
|
|
||
| - name: Wait for environment ready | ||
| id: wait | ||
| shell: bash | ||
| env: | ||
| CM_NAME: ${{ inputs.configmap-name }} | ||
| CM_NS: ${{ inputs.ci-env-namespace }} | ||
| TIMEOUT: ${{ inputs.timeout }} | ||
| run: | | ||
| echo "Waiting for ci-env-controller to provision the test environment..." | ||
| INTERVAL=10 | ||
| ELAPSED=0 | ||
|
|
||
| while true; do | ||
| STATUS="$(oc get configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| -o jsonpath='{.data.status}' 2>/dev/null || echo "")" | ||
|
|
||
| case "${STATUS}" in | ||
| ready) | ||
| echo "Environment is ready." | ||
| break | ||
| ;; | ||
| error) | ||
| ERR_MSG="$(oc get configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| -o jsonpath='{.data.error-message}' 2>/dev/null || echo "unknown error")" | ||
| echo "::error::Environment provisioning failed: ${ERR_MSG}" | ||
| exit 1 | ||
| ;; | ||
| *) | ||
| if (( ELAPSED >= TIMEOUT )); then | ||
| echo "::error::Timed out waiting for environment (status=${STATUS:-pending})" | ||
| exit 1 | ||
| fi | ||
| echo " status=${STATUS:-pending} (${ELAPSED}s / ${TIMEOUT}s)..." | ||
| sleep "${INTERVAL}" | ||
| ELAPSED=$(( ELAPSED + INTERVAL )) | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| BRIDGE_BASE_ADDRESS="$(oc get configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| -o jsonpath='{.data.bridge-base-address}')" | ||
| CONSOLE_ROUTE="$(oc get configmap "${CM_NAME}" -n "${CM_NS}" \ | ||
| -o jsonpath='{.data.console-route}' 2>/dev/null || echo "")" | ||
|
|
||
| echo "bridge-base-address=${BRIDGE_BASE_ADDRESS}" >> "${GITHUB_OUTPUT}" | ||
| echo "console-route=${CONSOLE_ROUTE}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| - name: Write job summary | ||
| shell: bash | ||
| env: | ||
| CM_NAME: ${{ inputs.configmap-name }} | ||
| CM_NS: ${{ inputs.ci-env-namespace }} | ||
| PLUGIN_IMAGE: ${{ inputs.plugin-image }} | ||
| TEST_NS: ${{ inputs.test-namespace }} | ||
| BRIDGE: ${{ steps.wait.outputs.bridge-base-address }} | ||
| ROUTE: ${{ steps.wait.outputs.console-route }} | ||
| run: | | ||
| { | ||
| echo "<details><summary>CI Test Environment</summary>" | ||
| echo "" | ||
| echo "| Input Parameter | Value |" | ||
| echo "|------|-------|" | ||
| echo "| ConfigMap | \`${CM_NS}/${CM_NAME}\` |" | ||
| echo "| Plugin image | \`${PLUGIN_IMAGE}\` |" | ||
| echo "| Test namespace | \`${TEST_NS}\` |" | ||
| echo "" | ||
| echo "| Output Parameter | Value |" | ||
| echo "|------|-------|" | ||
| echo "| Bridge base address | \`${BRIDGE}\` |" | ||
| echo "| Console route | \`${ROUTE}\` |" | ||
| echo "" | ||
| echo "</details>" | ||
| } >> "${GITHUB_STEP_SUMMARY}" |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.