Skip to content

🐛 combine bundle properties from csv and metadata/properties.yaml #1495

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

Merged

Conversation

joelanford
Copy link
Member

When we implemented support for including CSV annotations in chart metadata, we neglected to remember that bundle properties can also come from the metadata/properties.yaml file in the bundle filesystem. This PR updates the registry+v1 bundle converter library to read properties from metadata/properties.yaml (if it exists) and append any properties that are found into the metadata.annotations["olm.properties"] annotation in the CSV.

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@joelanford joelanford requested a review from a team as a code owner November 25, 2024 20:08
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 1426638
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/6744dc7818fa8700086f4ce8
😎 Deploy Preview https://deploy-preview-1495--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

if err != nil && !errors.Is(err, fs.ErrNotExist) {
return fmt.Errorf("failed to read properties.yaml file: %w", err)
}
if len(metadataPropertiesJSON) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are no metadataPropertiesJSON, then you can early exit this function

Copy link
Contributor

Choose a reason for hiding this comment

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

That would also decrease the overall indentation of the function...

Copy link
Member Author

Choose a reason for hiding this comment

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

@joelanford joelanford force-pushed the support-metadata-properties-yaml branch from 61cf3b3 to 1426638 Compare November 25, 2024 20:22
Comment on lines +423 to +433
Context("Should read the registry+v1 bundle filesystem correctly", func() {
It("should include metadata/properties.yaml and csv.metadata.annotations['olm.properties'] in chart metadata", func() {
fsys := os.DirFS("testdata/combine-properties-bundle")
chrt, err := RegistryV1ToHelmChart(context.Background(), fsys, "", nil)
Expect(err).NotTo(HaveOccurred())
Expect(chrt).NotTo(BeNil())
Expect(chrt.Metadata).NotTo(BeNil())
Expect(chrt.Metadata.Annotations).To(HaveKeyWithValue("olm.properties", `[{"type":"from-csv-annotations-key","value":"from-csv-annotations-value"},{"type":"from-file-key","value":"from-file-value"}]`))
})
})

Copy link
Contributor

Choose a reason for hiding this comment

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

ACK! We didn't get rid of Ginkgo everywhere‽‽

Copy link
Member Author

Choose a reason for hiding this comment

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

Or we did, but it came back when rukpak was pulled in.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

And I was part of that... oh well...

@tmshort
Copy link
Contributor

tmshort commented Nov 25, 2024

It LGTM, but are we waiting until 1.0.0, or not?

@joelanford
Copy link
Member Author

We can, not sure it matters either way since it is a bug fix.

Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 25, 2024
@tmshort
Copy link
Contributor

tmshort commented Nov 25, 2024

As long as we're taking it into consideration...

@joelanford
Copy link
Member Author

Yep, good call out!

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 58.97436% with 16 lines in your changes missing coverage. Please review.

Project coverage is 74.68%. Comparing base (c8179f3) to head (1426638).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/rukpak/convert/registryv1.go 58.97% 10 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1495      +/-   ##
==========================================
+ Coverage   74.67%   74.68%   +0.01%     
==========================================
  Files          42       42              
  Lines        3234     3271      +37     
==========================================
+ Hits         2415     2443      +28     
- Misses        646      652       +6     
- Partials      173      176       +3     
Flag Coverage Δ
e2e 52.15% <23.07%> (-0.35%) ⬇️
unit 57.99% <51.28%> (+0.88%) ⬆️

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.

@joelanford joelanford added this pull request to the merge queue Nov 25, 2024
@LalatenduMohanty
Copy link
Member

cc @gallettilance

@LalatenduMohanty
Copy link
Member

Yeah, we can merge bugfixes before 1.0.0.

@joelanford joelanford removed this pull request from the merge queue due to a manual request Nov 25, 2024
@tmshort tmshort added this pull request to the merge queue Nov 25, 2024
Merged via the queue into operator-framework:main with commit b9294a7 Nov 25, 2024
17 of 18 checks passed
@joelanford joelanford deleted the support-metadata-properties-yaml branch December 12, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants