scanner
scanner copied to clipboard
fix(ci): reorder gke tags and labels variable expansions
Description
If you're really unlucky, you can get a . at the end of the tags variable, which will be substituted for - after we replace the last - with x. GKE doesn't allow for - at the end of the string, which is why we change the last -.
See https://github.com/openshift/release/pull/47789 for a real-world example of this problem.
These changes reorders the shell expansion so we first replace all . with -, then delete the last -.
Cherry-picked from https://github.com/stackrox/scanner/pull/1513
Testing Performed
Testing the variable expansions:
# Before
❯ JOB_NAME=rehearse-47789-pull-ci-stackrox-scanner-release-2.32-e2e-tests
❯ tags="stackrox-ci"
❯ tags="${tags},stackrox-ci-${JOB_NAME:0:50}"
❯ echo "${tags}"
stackrox-ci,stackrox-ci-rehearse-47789-pull-ci-stackrox-scanner-release-2.
❯ tags="${tags/%-/x}"
❯ echo "${tags}"
stackrox-ci,stackrox-ci-rehearse-47789-pull-ci-stackrox-scanner-release-2.
❯ tags="${tags//./-}"
❯ echo "${tags}"
stackrox-ci,stackrox-ci-rehearse-47789-pull-ci-stackrox-scanner-release-2-
# After
❯ JOB_NAME=rehearse-47789-pull-ci-stackrox-scanner-release-2.32-e2e-tests
❯ tags="stackrox-ci"
❯ tags="${tags},stackrox-ci-${JOB_NAME:0:50}"
❯ tags="${tags//./-}"
❯ tags="${tags/%-/}"
❯ echo "${tags}"
stackrox-ci,stackrox-ci-rehearse-47789-pull-ci-stackrox-scanner-release-2
@BradLugo: 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/e2e-tests | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | false | /test e2e-tests |
| ci/prow/push-images | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | true | /test push-images |
| ci/prow/store-genesis-dump | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | false | /test store-genesis-dump |
| ci/prow/images | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | true | /test images |
| ci/prow/slim-e2e-tests | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | false | /test slim-e2e-tests |
| ci/prow/store-db-dump | 1df1326f8b1a10fa89953a9cddd5ce0cebdc345d | link | false | /test store-db-dump |
Full PR test history. Your PR dashboard.
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.
O.B.E - we're only supporting this change for 2.34+