Skip to content

test(ui): Export OpenShift creds to ui e2e test jobs#19701

Draft
dvail wants to merge 1 commit intomasterfrom
dv/pass-openshift-creds-to-ui-e2e-test
Draft

test(ui): Export OpenShift creds to ui e2e test jobs#19701
dvail wants to merge 1 commit intomasterfrom
dv/pass-openshift-creds-to-ui-e2e-test

Conversation

@dvail
Copy link
Copy Markdown
Contributor

@dvail dvail commented Mar 30, 2026

Description

TODO

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!

@dvail
Copy link
Copy Markdown
Contributor Author

dvail commented Mar 30, 2026

This change is part of the following stack:

Change managed by git-spice.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 30, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider guarding the source "${SHARED_DIR}/dotenv" call with a file existence check and a clear error message to avoid obscure failures if the dotenv file is missing or misnamed in CI.
  • The export OPENSHIFT_CONSOLE_*=... assignments are self-assignments; if the intent is simply to expose variables already defined by the dotenv file to child processes, a single set -a; source ...; set +a (or equivalent) would be simpler and less redundant.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding the `source "${SHARED_DIR}/dotenv"` call with a file existence check and a clear error message to avoid obscure failures if the dotenv file is missing or misnamed in CI.
- The `export OPENSHIFT_CONSOLE_*=...` assignments are self-assignments; if the intent is simply to expose variables already defined by the dotenv file to child processes, a single `set -a; source ...; set +a` (or equivalent) would be simpler and less redundant.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dvail
Copy link
Copy Markdown
Contributor Author

dvail commented Mar 30, 2026

/test ocp-4-21-ui-e2e-tests

@dvail
Copy link
Copy Markdown
Contributor Author

dvail commented Mar 30, 2026

/test ocp-qa-e2e-tests

@dvail
Copy link
Copy Markdown
Contributor Author

dvail commented Mar 30, 2026

/test ocp-4-21-qa-e2e-tests

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Enhanced OpenShift Console UI end-to-end test infrastructure with automatic credential provisioning, enabling properly configured browser-based testing of the console.
    • Improved test automation job routing to ensure proper environment initialization and variable provisioning for UI test execution.
    • Automated setup now includes console credentials for end-to-end testing scenarios.

Walkthrough

The changes add support for OpenShift Console UI end-to-end tests by updating the job routing mechanism to recognize ocp*ui-e2e-tests jobs and configuring the cluster setup process to export the required console credentials for browser-based authentication.

Changes

Cohort / File(s) Summary
CI Dispatch Routing
.openshift-ci/dispatch.sh
Added ocp*ui-e2e-tests pattern to job-to-cluster-setup routing to trigger cluster setup for OCP UI e2e test jobs.
Cluster Setup Configuration
tests/e2e/lib.sh
Added conditional block to source dotenv and export OPENSHIFT_CONSOLE_URL, OPENSHIFT_CONSOLE_USERNAME, and OPENSHIFT_CONSOLE_PASSWORD environment variables when ci_job matches OCP UI e2e test pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete with a 'TODO' placeholder in the main section and 'change me!' placeholders in the validation section, leaving critical details unexplained. Replace 'TODO' with a detailed explanation of why OpenShift creds are needed for UI e2e tests and complete the validation section explaining how the changes were tested.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: exporting OpenShift credentials to UI e2e test jobs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dv/pass-openshift-creds-to-ui-e2e-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/lib.sh`:
- Around line 1513-1518: The current export of
OPENSHIFT_CONSOLE_URL/USERNAME/PASSWORD will fail under set -u if any variable
is missing; after sourcing "${SHARED_DIR}/dotenv" in the ci_job ocp UI branch,
guard each export by either using a safe default expansion (e.g. export
OPENSHIFT_CONSOLE_URL="${OPENSHIFT_CONSOLE_URL:-}" ) or only exporting when set
(e.g. if [[ -n "${OPENSHIFT_CONSOLE_URL:-}" ]]; then export
OPENSHIFT_CONSOLE_URL; fi), and apply the same pattern for
OPENSHIFT_CONSOLE_USERNAME and OPENSHIFT_CONSOLE_PASSWORD so the script won't
abort when dotenv lacks those keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 83d14cb2-0d46-4fba-afa5-da9a5ac7e4e8

📥 Commits

Reviewing files that changed from the base of the PR and between 574b0ee and 95f5145.

📒 Files selected for processing (2)
  • .openshift-ci/dispatch.sh
  • tests/e2e/lib.sh

Comment on lines +1513 to +1518
if [[ "$ci_job" =~ ^ocp.*ui-e2e-tests$ ]]; then
info "Exporting OCP console credentials for UI tests"
source "${SHARED_DIR}/dotenv"
export OPENSHIFT_CONSOLE_URL="${OPENSHIFT_CONSOLE_URL}"
export OPENSHIFT_CONSOLE_USERNAME="${OPENSHIFT_CONSOLE_USERNAME}"
export OPENSHIFT_CONSOLE_PASSWORD="${OPENSHIFT_CONSOLE_PASSWORD}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard credential exports to avoid brittle set -u failures in UI jobs.

Because this script runs with set -u, expanding ${OPENSHIFT_CONSOLE_*} here will abort immediately if any key is missing in ${SHARED_DIR}/dotenv. That can fail the job before downstream auth-disabled/default handling is applied.

Proposed fix
     if [[ "$ci_job" =~ ^ocp.*ui-e2e-tests$ ]]; then
         info "Exporting OCP console credentials for UI tests"
         source "${SHARED_DIR}/dotenv"
-        export OPENSHIFT_CONSOLE_URL="${OPENSHIFT_CONSOLE_URL}"
-        export OPENSHIFT_CONSOLE_USERNAME="${OPENSHIFT_CONSOLE_USERNAME}"
-        export OPENSHIFT_CONSOLE_PASSWORD="${OPENSHIFT_CONSOLE_PASSWORD}"
+        export OPENSHIFT_CONSOLE_URL="${OPENSHIFT_CONSOLE_URL:-}"
+        if [[ "${OCP_BRIDGE_AUTH_DISABLED:-}" != "true" ]]; then
+            require_environment "OPENSHIFT_CONSOLE_USERNAME"
+            require_environment "OPENSHIFT_CONSOLE_PASSWORD"
+        fi
+        export OPENSHIFT_CONSOLE_USERNAME="${OPENSHIFT_CONSOLE_USERNAME:-}"
+        export OPENSHIFT_CONSOLE_PASSWORD="${OPENSHIFT_CONSOLE_PASSWORD:-}"
     fi

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/lib.sh` around lines 1513 - 1518, The current export of
OPENSHIFT_CONSOLE_URL/USERNAME/PASSWORD will fail under set -u if any variable
is missing; after sourcing "${SHARED_DIR}/dotenv" in the ci_job ocp UI branch,
guard each export by either using a safe default expansion (e.g. export
OPENSHIFT_CONSOLE_URL="${OPENSHIFT_CONSOLE_URL:-}" ) or only exporting when set
(e.g. if [[ -n "${OPENSHIFT_CONSOLE_URL:-}" ]]; then export
OPENSHIFT_CONSOLE_URL; fi), and apply the same pattern for
OPENSHIFT_CONSOLE_USERNAME and OPENSHIFT_CONSOLE_PASSWORD so the script won't
abort when dotenv lacks those keys.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 30, 2026

@dvail: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-4-21-qa-e2e-tests 95f5145 link false /test ocp-4-21-qa-e2e-tests
ci/prow/ocp-4-21-ui-e2e-tests 95f5145 link false /test ocp-4-21-ui-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant