Skip to content

*DO NOT MERGE*: Test GHA builds suppression#15351

Closed
msugakov wants to merge 7 commits intomasterfrom
misha/ROX-27716-test-konflux-release-like
Closed

*DO NOT MERGE*: Test GHA builds suppression#15351
msugakov wants to merge 7 commits intomasterfrom
misha/ROX-27716-test-konflux-release-like

Conversation

@msugakov
Copy link
Contributor

@msugakov msugakov commented May 19, 2025

On top of #15309 / testing for stackrox/konflux-tasks#55

The PR is marked as "Ready for review" but it isn't. I just want OSCI to start automatically without me having to type commands.

@openshift-ci
Copy link

openshift-ci bot commented May 19, 2025

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

@rhacs-bot
Copy link
Contributor

rhacs-bot commented May 19, 2025

Images are ready for the commit at a34e5a5.

To use with deploy scripts, first export MAIN_IMAGE_TAG=1.0.0-misha.test.1-1-ga34e5a51d6.

@codecov
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.23%. Comparing base (85a2b06) to head (a34e5a5).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15351      +/-   ##
==========================================
+ Coverage   49.21%   49.23%   +0.02%     
==========================================
  Files        2573     2573              
  Lines      188848   188854       +6     
==========================================
+ Hits        92937    92982      +45     
+ Misses      88583    88551      -32     
+ Partials     7328     7321       -7     
Flag Coverage Δ
go-unit-tests 49.23% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@msugakov msugakov added the scan-images-with-roxctl Tells `scan-images-with-roxctl` job to run label May 19, 2025
@msugakov msugakov force-pushed the misha/ROX-27716-take-konflux-on-release branch from d53b86d to c10654b Compare May 19, 2025 12:58
@msugakov msugakov force-pushed the misha/ROX-27716-test-konflux-release-like branch 2 times, most recently from 9cac587 to cd3ed76 Compare May 19, 2025 15:36
@msugakov
Copy link
Contributor Author

/cancel

@msugakov msugakov force-pushed the misha/ROX-27716-take-konflux-on-release branch 2 times, most recently from 2bce533 to 3ffd510 Compare May 19, 2025 15:39
@msugakov msugakov force-pushed the misha/ROX-27716-test-konflux-release-like branch from cd3ed76 to 94fda96 Compare May 19, 2025 15:39
@msugakov
Copy link
Contributor Author

/cancel

@msugakov msugakov force-pushed the misha/ROX-27716-take-konflux-on-release branch 2 times, most recently from 6fd3af6 to 14c2a59 Compare May 19, 2025 16:36
@msugakov msugakov force-pushed the misha/ROX-27716-test-konflux-release-like branch from 94fda96 to b0141e1 Compare May 19, 2025 16:37
@msugakov
Copy link
Contributor Author

/test ?

@openshift-ci
Copy link

openshift-ci bot commented May 19, 2025

@msugakov: No presubmit jobs available for stackrox/stackrox@misha/ROX-27716-take-konflux-on-release

Details

In response to this:

/test ?

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.

@msugakov msugakov changed the base branch from misha/ROX-27716-take-konflux-on-release to master May 19, 2025 17:28
@msugakov
Copy link
Contributor Author

/test ?

@openshift-ci

This comment was marked as outdated.

@msugakov
Copy link
Contributor Author

/test gke-nongroovy-e2e-tests gke-qa-e2e-tests

@msugakov
Copy link
Contributor Author

Expectedly, the e2e logs are full of

 INFO: Mon May 19 19:16:07 UTC 2025: Checking for central-db using https://quay.io/api/v1/repository/rhacs-eng/central-db/tag?specificTag=4.8.x-748-gb0141e1393
{"tags": [], "page": 1, "has_additional": false}
INFO: Mon May 19 19:16:07 UTC 2025: central-db does not exist 

because Konflux images have .0 instead of .x.

msugakov added 6 commits May 20, 2025 19:47
to get Konflux image tag suffix suppression
When there's only one matrix item (RHACS_BRANDING) and when it gets
excluded (with `exclude`), the corresponding job still runs but in
no-matrix mode. It's weird but that's the way it works.

`build-and-push-operator` seems to be the only job like this and
for it the default branding STACKROX_BRANDING gets assumed which
results in building images tagged for quay.io/stackrox-io.
Subsequently, any job steps that try to work with quay.io/rhacs-eng
images fail and so I disable them with an additional clause in the
`if` condition.
because the branch name should do the magic.
@msugakov msugakov force-pushed the misha/ROX-27716-test-konflux-release-like branch from b0141e1 to 3ca3d21 Compare May 21, 2025 08:36
@github-actions github-actions bot added area/ci konflux-build Run Konflux in PR. Push commit to trigger it. labels May 21, 2025
@msugakov msugakov marked this pull request as ready for review May 21, 2025 08:41
@msugakov msugakov requested review from a team as code owners May 21, 2025 08:41
Copy link
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 @msugakov - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

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.


if grep -qE '^((refs/heads/)?release-[0-9a-z]+\.[0-9a-z]+|refs/tags/[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?)$' <<< "${the_ref}"; then
log "This looks like a release branch or tag push. GHA quay.io/rhacs-eng/* builds must be suppressed in favor of the Konflux ones."
if [[ -f "${holdfile}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Temporary holdfile logic should be tracked for removal.

Define a removal plan for TODO ROX-29357 and eliminate the holdfile logic once testing completes to prevent confusion or unexpected behavior.

assert grep -F "$1" <<< "${stderr_lines[@]}"
}

@test "should fail when required values are not set" {
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider refactoring the repetitive test cases into table-driven loops with a helper function to reduce duplication.

You can collapse all of these almost-identical @test blocks into just a few loops + a small helper. For example, pull your per-test env setup + “which checker” into a table, then iterate:

#!/usr/bin/env bats
load "../test_helpers.bats"

# common setup / runner / checkers...
setup() {
  unset SOURCE_BRANCH TARGET_BRANCH GITHUB_REF GITHUB_BASE_REF GITHUB_HEAD_REF
  bats_require_minimum_version 1.5.0
}
run_cmd() {
  cp -a "${BATS_TEST_DIRNAME}/should-konflux-replace-gha-build.sh" \
       "${BATS_TEST_TMPDIR}/our-script.sh"
  run --separate-stderr "${BATS_TEST_TMPDIR}/our-script.sh"
}
check_both_go() {
  run_cmd; assert_success; assert_output "BUILD_AND_PUSH_BOTH"
  assert_stderr_contains "does not look like" "release" "branch or tag"
}
check_gha_suppressed() {
  run_cmd; assert_success; assert_output "BUILD_AND_PUSH_ONLY_KONFLUX"
  assert_stderr_contains "looks like" "release" "branch or tag"
}
check_gha_suppressed_for_pr() {
  run_cmd; assert_success; assert_output "BUILD_AND_PUSH_ONLY_KONFLUX"
  assert_stderr_contains "magic"
}

# generic table‐driven runner
run_scenario() {
  local envs="$1"; local fn="$2"
  for e in $envs; do export $e; done
  $fn
}

#–– Konflux tests ––  
declare -a KONFLUX_SCENARIOS=(
  "rc tag pushed|SOURCE_BRANCH=refs/tags/4.10.56-rc.172 TARGET_BRANCH=refs/tags/4.10.56-rc.172|check_gha_suppressed"
  "nightly tag|SOURCE_BRANCH=refs/tags/4.10.56-nightly.20250515 TARGET_BRANCH=refs/tags/4.10.56-nightly.20250515|check_both_go"
  "release-like branch|SOURCE_BRANCH=release-4.8 TARGET_BRANCH=release-4.8|check_gha_suppressed"
  "feature branch|SOURCE_BRANCH=author/ROX-27716-useful-feature TARGET_BRANCH=author/ROX-27716-useful-feature|check_both_go"
  "magic‐PR|SOURCE_BRANCH=author/konflux-release-like TARGET_BRANCH=master|check_gha_suppressed_for_pr"
  "normal‐PR|SOURCE_BRANCH=author/my-useful-feature TARGET_BRANCH=master|check_both_go"
  "PR→release target|SOURCE_BRANCH=author/my-useful-feature TARGET_BRANCH=release-4.8|check_gha_suppressed"
)

for scenario in "${KONFLUX_SCENARIOS[@]}"; do
  IFS='|' read -r desc envs fn <<<"$scenario"
  @test "Konflux: $desc" {
    run_scenario "$envs" "$fn"
  }
done

#–– GHA tests ––  
declare -a GHA_SCENARIOS=(
  "release tag|GITHUB_REF=refs/tags/24.58.60|check_gha_suppressed"
  "other tag|GITHUB_REF=refs/tags/0.0.0-author-testing|check_both_go"
  "release-like branch|GITHUB_REF=refs/heads/release-x.y|check_gha_suppressed"
  "feature branch|GITHUB_REF=refs/heads/many-funky/...|check_both_go"
)

for scenario in "${GHA_SCENARIOS[@]}"; do
  IFS='|' read -r desc envs fn <<<"$scenario"
  @test "GHA: $desc" {
    run_scenario "$envs" "$fn"
  }
done

# a couple of special‐case/tests can stay explicit (failure‐modes, holdfile)
@test "should fail when required values are not set" {
  run_cmd; assert_failure 2
}
@test "GHA: fail on PR without BASE/HEAD" {
  export GITHUB_REF=refs/pull/1005006/merge
  run_cmd; assert_failure 3
}

@test "should respect holdfile when release push" {
  export SOURCE_BRANCH=release-4.8 TARGET_BRANCH=release-4.8
  touch "${BATS_TEST_TMPDIR}/should-konflux-replace-gha-build.hold"
  run_cmd; assert_success; assert_output "BUILD_AND_PUSH_BOTH"
  assert_stderr_contains "holdfile"
}
@test "should ignore holdfile when PR with magic branch" {
  export SOURCE_BRANCH=author/konflux-release-like TARGET_BRANCH=master
  touch "${BATS_TEST_TMPDIR}/should-konflux-replace-gha-build.hold"
  check_gha_suppressed_for_pr
}

This preserves every single assertion, but collapses ~20 nearly-identical @test blocks down to 2 arrays + a tiny runner.

@msugakov
Copy link
Contributor Author

/retest operator-bundle-on-push

@stackrox stackrox deleted a comment from openshift-ci bot May 21, 2025
@msugakov
Copy link
Contributor Author

/cancel

@msugakov
Copy link
Contributor Author

/retest central-db-on-push

@msugakov
Copy link
Contributor Author

/retest operator-on-push

@msugakov
Copy link
Contributor Author

/retest operator-bundle-on-push

@stackrox stackrox deleted a comment from openshift-ci bot May 21, 2025
@stackrox stackrox deleted a comment from openshift-ci bot May 21, 2025
@stackrox stackrox deleted a comment from openshift-ci bot May 21, 2025
@msugakov
Copy link
Contributor Author

/retest operator-on-push

@stackrox stackrox deleted a comment from openshift-ci bot May 21, 2025
@msugakov
Copy link
Contributor Author

/test gke-scanner-v4-install-tests gke-nongroovy-e2e-tests gke-upgrade-tests gke-qa-e2e-tests gke-operator-e2e-tests ocp-4-12-scanner-v4-install-tests ocp-4-12-operator-e2e-tests ocp-4-12-qa-e2e-tests ocp-4-12-nongroovy-e2e-tests ocp-4-18-operator-e2e-tests ocp-4-18-scanner-v4-install-tests ocp-4-18-nongroovy-e2e-tests ocp-4-18-qa-e2e-tests

@openshift-ci
Copy link

openshift-ci bot commented May 22, 2025

@msugakov: 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/gke-nongroovy-e2e-tests a34e5a5 link true /test gke-nongroovy-e2e-tests
ci/prow/gke-qa-e2e-tests a34e5a5 link false /test gke-qa-e2e-tests
ci/prow/gke-upgrade-tests a34e5a5 link false /test gke-upgrade-tests
ci/prow/gke-operator-e2e-tests a34e5a5 link false /test gke-operator-e2e-tests
ci/prow/gke-scanner-v4-install-tests a34e5a5 link false /test gke-scanner-v4-install-tests
ci/prow/ocp-4-18-qa-e2e-tests a34e5a5 link false /test ocp-4-18-qa-e2e-tests
ci/prow/ocp-4-12-scanner-v4-install-tests a34e5a5 link false /test ocp-4-12-scanner-v4-install-tests
ci/prow/ocp-4-12-nongroovy-e2e-tests a34e5a5 link false /test ocp-4-12-nongroovy-e2e-tests
ci/prow/ocp-4-12-operator-e2e-tests a34e5a5 link false /test ocp-4-12-operator-e2e-tests
ci/prow/ocp-4-18-operator-e2e-tests a34e5a5 link false /test ocp-4-18-operator-e2e-tests
ci/prow/ocp-4-18-scanner-v4-install-tests a34e5a5 link false /test ocp-4-18-scanner-v4-install-tests
ci/prow/ocp-4-12-qa-e2e-tests a34e5a5 link false /test ocp-4-12-qa-e2e-tests
ci/prow/ocp-4-18-nongroovy-e2e-tests a34e5a5 link false /test ocp-4-18-nongroovy-e2e-tests
ci/prow/gke-ui-e2e-tests a34e5a5 link true /test gke-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.

@msugakov
Copy link
Contributor Author

I need to close this because I'm losing track of things.

@msugakov msugakov closed this May 27, 2025
@msugakov msugakov deleted the misha/ROX-27716-test-konflux-release-like branch May 27, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci konflux-build Run Konflux in PR. Push commit to trigger it. scan-images-with-roxctl Tells `scan-images-with-roxctl` job to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants