test(ui): Export OpenShift creds to ui e2e test jobs#19701
test(ui): Export OpenShift creds to ui e2e test jobs#19701
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
There was a problem hiding this comment.
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 singleset -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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
/test ocp-4-21-ui-e2e-tests |
|
/test ocp-qa-e2e-tests |
|
/test ocp-4-21-qa-e2e-tests |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes add support for OpenShift Console UI end-to-end tests by updating the job routing mechanism to recognize Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.openshift-ci/dispatch.shtests/e2e/lib.sh
| 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}" |
There was a problem hiding this comment.
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:-}"
fiAs 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.
|
@dvail: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Description
TODO
User-facing documentation
Testing and quality
Automated testing
How I validated my change
change me!