Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate index generation process to File-Based Catalog #2054

Merged
merged 1 commit into from
Aug 21, 2022

Conversation

orenc1
Copy link
Collaborator

@orenc1 orenc1 commented Aug 16, 2022

SQLite-Based catlog format, which we were using so far, is being deprecated in favour of the new format of file-based catalog.
With this change, the 'opm index add --bundles' command no longer works, and we need to change the workflow to work with json files inside the catalog image.
References:

Signed-off-by: Oren Cohen ocohen@redhat.com

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Release note:

migrate to FBC in index image workflows.

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M labels Aug 16, 2022
@coveralls
Copy link
Collaborator

coveralls commented Aug 16, 2022

Pull Request Test Coverage Report for Build 2897762102

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 84.969%

Totals Coverage Status
Change from base Build 2888057182: 0.0%
Covered Lines: 4460
Relevant Lines: 5249

💛 - Coveralls

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 16, 2022

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 16, 2022

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

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/test-infra repository.

Copy link
Collaborator

@nunnatsa nunnatsa left a comment

Choose a reason for hiding this comment

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

Looks very good.

Added some comments.

fi

${OPM} render ${BUNDLE_IMAGE_NAME} > bundle.json
CSV_NAME=$(jq .name bundle.json | tr -d '"')
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use the -r flag instead of tr -d:

Suggested change
CSV_NAME=$(jq .name bundle.json | tr -d '"')
CSV_NAME=$(jq -r .name bundle.json)

${OPM} index add --bundles "${BUNDLE_IMAGE_NAME}" ${INDEX_IMAGE_PARAM} --tag "${INDEX_IMAGE_NAME}" -u podman --mode semver

# File-Based Catalog handling
${OPM} migrate ${INDEX_IMAGE_NAME} fbc-catalog || true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should avoid writing to the root directory of the project. What do you think about output to _out/fbc-catalog?

If you do that, please add an env var for this path, in order to use it later in the script.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it would be better to change the working directory in this part to ${PROJECT_ROOT}/_out to avoid adding the _out/ prefix for every file reference.

oc image extract ${INDEX_IMAGE_NAME} --file /configs/catalog.json
else
# The migration took place
mv fbc-catalog/community-kubevirt-hyperconverged/catalog.json catalog.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move to _out/catalog.json

mv fbc-catalog/community-kubevirt-hyperconverged/catalog.json catalog.json
fi

${OPM} render ${BUNDLE_IMAGE_NAME} > bundle.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

please write to _out/bundle.json

${OPM} index add --bundles "${BUNDLE_IMAGE_NAME}" ${INDEX_IMAGE_PARAM} --tag "${INDEX_IMAGE_NAME}" -u podman --mode semver

# File-Based Catalog handling
${OPM} migrate ${INDEX_IMAGE_NAME} fbc-catalog || true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please wrap with double quotes.

Suggested change
${OPM} migrate ${INDEX_IMAGE_NAME} fbc-catalog || true
${OPM} migrate "${INDEX_IMAGE_NAME}" _out/fbc-catalog || true

if [ ! -d fbc-catalog ]
then
# The index image is already in file-based format. Extracting its catalog file
oc image extract ${INDEX_IMAGE_NAME} --file /configs/catalog.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please wrap with double quotes.

Suggested change
oc image extract ${INDEX_IMAGE_NAME} --file /configs/catalog.json
oc image extract "${INDEX_IMAGE_NAME}" --file /configs/catalog.json

mv fbc-catalog/community-kubevirt-hyperconverged/catalog.json catalog.json
fi

${OPM} render ${BUNDLE_IMAGE_NAME} > bundle.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
${OPM} render ${BUNDLE_IMAGE_NAME} > bundle.json
${OPM} render "${BUNDLE_IMAGE_NAME}" > _out/bundle.json

select(.schema=="olm.bundle" and (.name | contains($CHANNEL))))' \
updated_fbc.json.tmp > updated_fbc.json

mkdir -p fbc-catalog
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe _out/fbc-catalog?

remove_tmp_files
}

function remove_tmp_files() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

not needed if everything in _out

@orenc1 orenc1 force-pushed the migrate_unstable_index_to_fbc branch from 3c10dee to f06e5c8 Compare August 17, 2022 14:42
@hco-bot
Copy link
Collaborator

hco-bot commented Aug 17, 2022

hco-e2e-upgrade-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-index-aws

In response to this:

hco-e2e-upgrade-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-aws

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 17, 2022

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp
hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp, ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp
hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 17, 2022

hco-e2e-kv-smoke-gcp lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-kv-smoke-azure

In response to this:

hco-e2e-kv-smoke-gcp lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-azure

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/test-infra repository.

${OPM} index add --bundles "${BUNDLE_IMAGE_NAME}" ${INDEX_IMAGE_PARAM} --tag "${INDEX_IMAGE_NAME}" -u podman --mode semver

# File-Based Catalog handling
cd "${OUT_DIR}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will work. But I'm not sure I'm happy with cd and cd back. What do you think about placing all of this in a new function, then call it like this?

(cd "${OUT_DIR}" && my_new_function)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

valid point.
updated, thanks.

SQLite-Based catlog format, which we were using so far, is being deprecated in favour of the new format of file-based catalog.
With this change, the 'opm index add --bundles' command no longer works, and we need to change the workflow to work with json files inside the catalog image.
References:
- https://olm.operatorframework.io/docs/reference/file-based-catalogs/
- k8s-operatorhub/community-operators#505

Signed-off-by: Oren Cohen <ocohen@redhat.com>
@orenc1 orenc1 force-pushed the migrate_unstable_index_to_fbc branch from f06e5c8 to 05c1fb7 Compare August 21, 2022 08:16
@sonarcloud
Copy link

sonarcloud bot commented Aug 21, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@nunnatsa
Copy link
Collaborator

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 21, 2022
@hco-bot
Copy link
Collaborator

hco-bot commented Aug 21, 2022

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 21, 2022

hco-e2e-image-index-gcp, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-azure

In response to this:

hco-e2e-image-index-gcp, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-azure

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/test-infra repository.

@openshift-ci
Copy link

openshift-ci bot commented Aug 21, 2022

@orenc1: 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/hco-e2e-upgrade-prev-index-azure 05c1fb7 link true /test hco-e2e-upgrade-prev-index-azure
ci/prow/hco-e2e-image-index-azure 05c1fb7 link true /test hco-e2e-image-index-azure
ci/prow/hco-e2e-upgrade-prev-index-sno-azure 05c1fb7 link false /test hco-e2e-upgrade-prev-index-sno-azure

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/test-infra repository. I understand the commands that are listed here.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 21, 2022

hco-e2e-upgrade-prev-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-sno-azure

In response to this:

hco-e2e-upgrade-prev-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-azure

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/test-infra repository.

@nunnatsa
Copy link
Collaborator

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nunnatsa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 21, 2022
@kubevirt-bot kubevirt-bot merged commit d689d03 into kubevirt:main Aug 21, 2022
@orenc1 orenc1 deleted the migrate_unstable_index_to_fbc branch August 21, 2022 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants