Skip to content

feat(ISV-6697): Release pipeline uses pending index repositories#923

Merged
JakubDurkac merged 13 commits intoISV-6696-6697from
ISV-6697
Apr 22, 2026
Merged

feat(ISV-6697): Release pipeline uses pending index repositories#923
JakubDurkac merged 13 commits intoISV-6696-6697from
ISV-6697

Conversation

@JakubDurkac
Copy link
Copy Markdown
Contributor

  1. For release pipeline, use pending repositories as source for index images.
  2. Use IIB overwrite token in release pipeline to overwrite the source pending repositories.
  3. Specify tags (version + permanent tag) for index images. These are passed to IIB API calls and publish task.
  4. Passing the overwrite token using newly added "iib-credentials" workspace. Added 'set -e' and switched to not using '--verbose' for add-bundle-to-index and build-fbc-index-image, the tasks token is newly passed to (inspired by publish-task and add-bundle-to-index, which worked with secrets prior to these changes).

Merging to non-primary branch, so that we can test and merge both this (ISV-6696) and release pipeline changes (ISV-6697) to main at the same time.

WARNING: Currently it seems that the overwrite token passed to IIB API build request is not working due to some bug, therefore the builds fail, because they fail to overwrite "-pending" repositories (unauthorized), so we can't fully test the changes currently. More info here in the ticket I've opened.

Merge Request Checklists

  • Development is done in feature branches
  • Code changes are submitted as pull request into a primary branch [Provide reason for non-primary branch submissions]
  • Code changes are covered with unit and integration tests.
  • Code passes all automated code tests:
    • Linting
    • Code formatter - Black
    • Security scanners
    • Unit tests
    • Integration tests
  • Code is reviewed by at least 1 team member
  • Pull request is tagged with "risk/good-to-go" label for minor changes

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Release pipeline uses pending index repositories with IIB overwrite support

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add IIB overwrite token support to enable pending repository overwrites
• Implement build tags suffix for consistent tagging across IIB and publish tasks
• Update release pipeline to use pending repositories as index image sources
• Remove environment-specific conditionals (dev/qa/preprod) from pipeline tasks
• Add new generate-build-timestamp task for Unix timestamp generation
• Update Ansible tasks to pass credentials via iib-credentials workspace
Diagram
flowchart LR
  A["Release Pipeline"] -->|"uses pending repos"| B["IIB API"]
  B -->|"overwrite token"| C["Pending Repositories"]
  D["generate-build-timestamp"] -->|"timestamp suffix"| E["IIB Builds"]
  E -->|"same tags"| F["publish-to-index"]
  G["iib-credentials workspace"] -->|"username:password"| E
Loading

Grey Divider

File Changes

1. operatorcert/entrypoints/add_fbc_fragments_to_index.py ✨ Enhancement +32/-2

Add overwrite token and build tags support

operatorcert/entrypoints/add_fbc_fragments_to_index.py


2. operatorcert/entrypoints/index.py ✨ Enhancement +33/-3

Add overwrite token and build tags parameters

operatorcert/entrypoints/index.py


3. operatorcert/entrypoints/rm_operator_from_index.py ✨ Enhancement +32/-2

Add overwrite token and build tags support

operatorcert/entrypoints/rm_operator_from_index.py


View more (12)
4. tests/entrypoints/test_add_fbc_fragments_to_index.py 🧪 Tests +36/-0

Add unit tests for overwrite token functionality

tests/entrypoints/test_add_fbc_fragments_to_index.py


5. tests/entrypoints/test_index.py 🧪 Tests +31/-0

Add unit tests for overwrite token and build tags

tests/entrypoints/test_index.py


6. tests/entrypoints/test_rm_operator_from_index.py 🧪 Tests +31/-0

Add unit tests for overwrite token functionality

tests/entrypoints/test_rm_operator_from_index.py


7. ansible/roles/operator-pipeline/tasks/community-release-pipeline-trigger.yml ⚙️ Configuration changes +3/-0

Add iib-credentials workspace to pipeline

ansible/roles/operator-pipeline/tasks/community-release-pipeline-trigger.yml


8. ansible/roles/operator-pipeline/tasks/operator-release-pipeline-trigger.yml ⚙️ Configuration changes +3/-0

Add iib-credentials workspace to pipeline

ansible/roles/operator-pipeline/tasks/operator-release-pipeline-trigger.yml


9. ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml ⚙️ Configuration changes +2/-2

Switch to pending repositories for index images

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml


10. ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml ⚙️ Configuration changes +27/-2

Add timestamp generation and pending repo support

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml


11. ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml ✨ Enhancement +24/-13

Add iib-credentials workspace and token handling

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml


12. ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml ✨ Enhancement +41/-22

Add iib-credentials workspace and remove env conditionals

ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml


13. ansible/roles/operator-pipeline/templates/openshift/tasks/generate-build-timestamp.yml ✨ Enhancement +20/-0

New task to generate Unix timestamp for tagging

ansible/roles/operator-pipeline/templates/openshift/tasks/generate-build-timestamp.yml


14. ansible/roles/operator-pipeline/templates/openshift/tasks/get-supported-versions.yml ✨ Enhancement +12/-0

Add pending repository result output

ansible/roles/operator-pipeline/templates/openshift/tasks/get-supported-versions.yml


15. ansible/roles/operator-pipeline/templates/openshift/tasks/publish-to-index.yml 🐞 Bug fix +8/-5

Use consistent timestamp and fix image parsing

ansible/roles/operator-pipeline/templates/openshift/tasks/publish-to-index.yml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 1, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Unquoted token args🐞 Bug ⛨ Security
Description
The overwrite token is assembled into EXTRA_ARGS/TOKEN_ARG and later expanded unquoted, which
triggers shell word-splitting and pathname expansion; tokens with whitespace/newlines/glob
characters can corrupt CLI args and break IIB calls (and potentially expand to local filenames).
This affects both add-bundle-to-index and build-fbc-index-images tasks.
Code

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[R100-109]

+        # Add IIB overwrite token if credentials workspace is provided (for release pipeline)
+        if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
+          IIB_QUAY_USER=$(cat $(workspaces.iib-credentials.path)/username)
+          IIB_QUAY_TOKEN=$(cat $(workspaces.iib-credentials.path)/password)
+          EXTRA_ARGS+=" --iib-overwrite-token ${IIB_QUAY_USER}:${IIB_QUAY_TOKEN}"
+
+          # Add build tags suffix for consistent tagging with publish task
+          if [[ "$(params.build_tags_suffix)" != "" ]]; then
+            EXTRA_ARGS+=" --build-tags-suffix $(params.build_tags_suffix)"
+          fi
Evidence
add-bundle-to-index reads username/password from the secret workspace, concatenates them into a
single string argument, and then passes $EXTRA_ARGS unquoted into the index command; similarly
build-fbc-index-images builds TOKEN_ARG and passes $TOKEN_ARG unquoted into CLIs. In bash,
unquoted variable expansion performs word-splitting and glob expansion, so certain token contents
can change the number/value of arguments passed.

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[100-118]
ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml[91-112]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tasks construct overwrite-token CLI arguments inside strings (`EXTRA_ARGS`/`TOKEN_ARG`) and then expand those strings unquoted when invoking the CLI. This allows bash word-splitting and pathname expansion to mutate the intended arguments.
### Issue Context
These args include secrets (`username:password`) coming from a Secret volume. Even if current tokens don’t contain whitespace, this is brittle and can fail unexpectedly.
### Fix Focus Areas
- ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[100-118]
- ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml[91-112]
### Suggested fix approach
- Read secret files safely and trim newlines, e.g.:
- `IIB_QUAY_USER="$(tr -d '\n\r' < "$(workspaces.iib-credentials.path)/username")"`
- `IIB_QUAY_TOKEN="$(tr -d '\n\r' < "$(workspaces.iib-credentials.path)/password")"`
- Use bash arrays for optional args:
- `EXTRA_ARGS=()` / `TOKEN_ARGS=()`
- `EXTRA_ARGS+=("--iib-overwrite-token" "${IIB_QUAY_USER}:${IIB_QUAY_TOKEN}")`
- `EXTRA_ARGS+=("--build-tags-suffix" "$(params.build_tags_suffix)")`
- Invoke commands with array expansion:
- `index ... "${EXTRA_ARGS[@]}"`
- `add-fbc-fragments-to-index ... "${TOKEN_ARGS[@]}"`
This avoids word-splitting/globbing and keeps secrets as single, exact arguments.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Unused environment parameter🐞 Bug ⚙ Maintainability
Description
add-bundle-to-index and build-fbc-index-images still accept/pass an environment parameter and
assign it to ENV, but they never use it afterward, leaving dead code and making runtime behavior
harder to reason about. This increases the risk of misconfiguration because users may expect
env-specific behavior that no longer exists.
Code

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[R84-86]

ENV=$(params.environment)
INDEX_IMAGES="$(params.index_images)"
-        if [[ $ENV != "prod" ]]; then
-            # Replace registry urls with stage urls when in preprod
-            INDEX_IMAGES=${INDEX_IMAGES//registry.redhat.io/registry.stage.redhat.io}
-        fi
-
-        if [[ $ENV == "dev" || $ENV == "qa" ]]; then
-            echo "Adding bundle to an index is a NOOP for dev and qa environments at this time."
-            echo -n "success" | tee "$(results.status.path)"
-            # output dummy/test values for following tasks
-            echo -n "placeholder" | tee "$(workspaces.output.path)/index-image-paths.txt"
-            exit 0
-        fi
Evidence
Both tasks set ENV=$(params.environment) but have no subsequent conditional logic that references
ENV. Meanwhile, the pipelines explicitly document that env can be set to multiple environments,
which implies it is expected to affect behavior.

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[80-90]
ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml[88-96]
ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml[30-32]
ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml[25-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tasks accept an `environment` param, assign it to `ENV`, but never use it. This is dead code and can mislead operators into thinking env changes behavior.
### Issue Context
The pipeline params explicitly list multiple env values, which suggests env is meaningful.
### Fix Focus Areas
- ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml[80-90]
- ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml[88-90]
- ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml[136-138]
### Suggested fix approach
Pick one:
1) If env is no longer needed: remove the `environment` param from these Tasks and stop passing it from pipelines.
2) If env is still intended to influence behavior: reintroduce explicit branching based on `$(params.environment)` and add comments/tests validating expected behavior per env.
Also remove the unused `ENV=` assignments once the final behavior is decided.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
IIB_QUAY_USER=$(cat $(workspaces.iib-credentials.path)/username)
IIB_QUAY_TOKEN=$(cat $(workspaces.iib-credentials.path)/password)
EXTRA_ARGS+=" --iib-overwrite-token ${IIB_QUAY_USER}:${IIB_QUAY_TOKEN}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should avoid using cli params to pass secrets. I think better solution is to use env vars and load it from the env vars in the script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in the latest commit. Let me know if you meant it differently.

Comment thread operatorcert/entrypoints/index.py Outdated
IIB module for building a index images for a bundle
"""

# pylint: disable=duplicate-code
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be set only on affected parts of code rather than on the whole file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be better now.

# DO NOT USE set -x to avoid revealing credentials in logs!
set -e

ENV=$(params.environment)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be removed, since it is unused after removal of the if condition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not seeing the removal of the condition in diff anymore. Was it something form different PR that is already present in the target branch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we merged #921 , so ISV-6696 (hosted pipeline changes) to the target branch ISV-6696-6697, and it included removal of the "if" conditions. So the commit is already part of target branch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see, thanks for explaining 👍

@JakubDurkac
Copy link
Copy Markdown
Contributor Author

JakubDurkac commented Apr 10, 2026

As it seems it will take some time for the overwrite token bug to be fixed by IIB, I've made a simple temporary workaround that we can remove later, doing the overwriting manually. Made it just to see if the tests results look otherwise correct. Here are some tests with logs, you can look if you're interested. I was mainly checking if the sources and destinations are as expected for both add-bundle task, and then the publish task, including the version + permanent tags. Those look correct for these tests:

  1. make build-and-test-isv
  1. make build-and-test-community
  1. make build-and-test-isv-fbc-bundle (also successful, but probably not that relevant to the changes made)

The 'make build-and-test-isv-fbc-catalog' is currently getting stuck for me on hosted pipeline, I'm trying to find out why. I'll add results if I get some (EDIT: fixed, see comment below). Just FYI @Allda, @RichardPlesnik. Also, please let me know if you would like to run some additional tests, so when the IIB is fixed, we are prepared to move forward.

@JakubDurkac
Copy link
Copy Markdown
Contributor Author

I've found out that the pipeline was getting stuck on fbc catalog test, because get-supported-versions task was generating results that were too big. Apparently by my addition of max_supported_pending_repository we barely hit over 4 KB limit by a few bytes, which lead to the results being truncated. The "message" attribute of "supported-version-check" step, which is a string holding the JSON result object was missing few versions of the last attribute "indices_ocp_versions" and proper closing brackets, which lead to pipeline getting stuck. We would've probably hit it also if there was like 1 more supported OCP version in the list, so to be completely safe long term, I've removed currently unused repositories_with_version and public_repository_mirrors_with_version from results, which should make the results like 60 % smaller. The last thing we need to pass all tests is for IIB to put a new functioning default reading token to stage, because there's a wrong one active at the moment, therefore pipeline is failing with unauthorized, could not find robot with username... logs: https://gist.github.com/rh-operator-bundle-bot/bcae4a6a66a0ac9a0126374839965694

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2026
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2026
value: "$(params.pipeline_image)"
- name: index_images
value: "$(tasks.get-supported-versions.results.public_repository_mirrors_with_version)"
value: "$(tasks.get-supported-versions.results.max_supported_pending_repository)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be pending_repositories_with_version?

Copy link
Copy Markdown
Contributor

@Allda Allda left a comment

Choose a reason for hiding this comment

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

I noticed in the pipeline logs that by changing the IIB build source you accidentally change the signing step. The old solution send a signing request with following payload:

"docker_reference": "registry.redhat.io/redhat/community-operator-index:v4.14", "image_name": "redhat/community-operator-index",

The new solution is using a different reference:

'docker_reference': 'quay.io/redhat-pending/redhat----community-operator-index-pending:v4.20', 'errors': [], 'image_name': 'redhat-pending/redhat----community-operator-index-pending',

This needs to be fixed; otherwise, the indexes won't be properly signed.

@JakubDurkac
Copy link
Copy Markdown
Contributor Author

I made changes to sign-index-image task:

  1. In release pipeline, task uses public repository mirror as reference (added public_repository_mirror as parameter passed to the task).
  2. In release pipeline, task uses pending repository with digest SHA as inspect target for skopeo (added secret for reading '*-pending' repositories; prod env can read (inspect) quay 'redhat' org's pending repositories; non-prod envs can read quay 'redhat-pending' org's pending repositories).
  3. Task is made backward compatible with other pipeline that uses it (index-img-bootstrap-signing-pipeline). Based on presence of public_repository_mirror param, decides to set reference and inspect target for skopeo, either as described above for release pipeline usage, or to reference = inspect target = public repository mirror for index image bootstrap signing pipeline, the same way it was before.

When the certificate renewal is merged to main #933, I'll rebase and run the tests.

@JakubDurkac
Copy link
Copy Markdown
Contributor Author

The signing step should be fixed now. Let me know what you think. @Allda

@JakubDurkac JakubDurkac merged commit 62fa40f into ISV-6696-6697 Apr 22, 2026
19 of 22 checks passed
@JakubDurkac JakubDurkac deleted the ISV-6697 branch April 22, 2026 12:23
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.

3 participants