open-cluster-management-io / multicloud-operators-subscription

Enables multicluster application delivery.
https://open-cluster-management.io/getting-started/integration/app-lifecycle/
Apache License 2.0
44 stars 39 forks source link

Don't call helm Get to pick up the latest version when there is only … #386

Closed xiangjingli closed 9 months ago

xiangjingli commented 9 months ago

…one version for the given chart

https://issues.redhat.com/browse/ACM-7031?focusedId=24072452&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-24072452

xiangjingli commented 9 months ago

/hold

xiangjingli commented 9 months ago

@mikeshng It turns out the helm Get fails to figure the latest version for the 3.0.0-stable semVer pattern.

I feel the PR may be a easy fix for covering most cases - When specifying the version pattern 3.0.0-stable, users may mainly want to fetch the exact version of the chart, So unlikely they will use this pattern>3.0.0-stable. Then only one version of the chart is fetched. Thus we won't call helm Get to figure out the latest version

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6cfc950) 55.21% compared to head (36293ca) 55.71%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #386 +/- ## ========================================== + Coverage 55.21% 55.71% +0.50% ========================================== Files 71 71 Lines 15317 15320 +3 ========================================== + Hits 8457 8536 +79 + Misses 6011 5932 -79 - Partials 849 852 +3 ``` | [Flag](https://app.codecov.io/gh/open-cluster-management-io/multicloud-operators-subscription/pull/386/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-cluster-management-io) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/open-cluster-management-io/multicloud-operators-subscription/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-cluster-management-io) | `55.71% <ø> (+0.50%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-cluster-management-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

xiangjingli commented 9 months ago

@mikeshng I realized there is a code defect in the previous fix due to my misunderstanding of the indexfile.entries

indexFile.Entries map[string]ChartVersions

Each map index is a chart name, and it could include multiple versions. So checking if there is only one version for the chart should be in each chart by looping the indexFile.Entries

mikeshng commented 9 months ago

/approve

/lgtm

openshift-ci[bot] commented 9 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mikeshng, xiangjingli

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: - ~~[OWNERS](https://github.com/open-cluster-management-io/multicloud-operators-subscription/blob/main/OWNERS)~~ [mikeshng,xiangjingli] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment