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

[v1.3] Add addon version check with the repo #754

Open
wants to merge 1 commit into
base: v1.3
Choose a base branch
from

Conversation

w13915984028
Copy link
Member

Problem:

Addon & repo chart version mis-matching (e.g. harvester/harvester#5840)

Solution:

Check version matching in the step of build-bundle

In amd64 architecture, the mismatching will cause build failure
In arm64 architecture, the mismatching will print some WARNING messages but build continue

Related Issue:
harvester/harvester#4937
harvester/harvester#5840

Test plan:

Refer #750 (comment)

This is a manual backport of #750, as the addon upgrade path is changed in master-head.

Signed-off-by: Jian Wang <jian.wang@suse.com>
Copy link
Contributor

@tserong tserong left a comment

Choose a reason for hiding this comment

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

LGTM, just one small suggestion (apologies for missing this when reviewing #750)

fi
done

echo "all upgrade addons have matched version with the repo"
Copy link
Contributor

Choose a reason for hiding this comment

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

As we're not failing the build on mismatches per #750 (comment), this line will always be printed. Better to either print a count of mismatches, or maybe just not print this line at all, e.g.:

@@ -180,6 +180,7 @@ check_upgrade_addon_chart_version_matching() {
   echo "upgrade addon files"
   ls -alht ${harvester_path}/package/upgrade/addons
 
+  local mismatches=0
   for filename in ${harvester_path}/package/upgrade/addons/*.yaml; do
     local tmpfile=/tmp/$(basename ${filename})
     grep -v "{{" ${filename} > ${tmpfile}
@@ -203,10 +204,13 @@ check_upgrade_addon_chart_version_matching() {
      # a new version bumping generally means two PRs
      # directly return 1 will cause failure in build
      echo  WARNING upgrade addon "$chart" has version mis-matching: in repo is "$repover" but in addon is "$version"
+     (( mismatches +=1 ))
     fi
   done
 
-  echo "all upgrade addons have matched version with the repo"
+  if [[ $mismatches -eq 0 ]]; then
+    echo "all upgrade addons have matched version with the repo"
+  fi
 }
 
 check_upgrade_addon_chart_version_matching

Copy link
Member

@brandboat brandboat left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +160 to +161
echo WARNING: addon $chart is defined, but the chart is not packed into repo / repo struct is changed
continue
Copy link
Member

Choose a reason for hiding this comment

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

nit: the indention is 1 space instead of 2spaces.

Comment on lines +166 to +168
echo WARNING: addon "$chart" is defined with version "$version" but the chart is not packed into repo in ${ARCH}
elif [[ $repover != $version ]]; then
echo addon "$chart" has version mis-matching: in repo is "$repover" but in addon is "$version"
Copy link
Member

Choose a reason for hiding this comment

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

same here

Comment on lines +194 to +195
echo WARNING: upgrade addon $chart is defined, but the chart is not packed into repo / repo struct is changed
continue
Copy link
Member

Choose a reason for hiding this comment

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

same here

Comment on lines +200 to +205
echo WARNING: upgrade addon "$chart" is defined with version "$version" but the chart is not packed into repo in ${ARCH}
elif [[ $repover != $version ]]; then
# the upgrade addon is stored in GH harvester; but the chart repo is stored in GH harvester-installer
# a new version bumping generally means two PRs
# directly return 1 will cause failure in build
echo WARNING upgrade addon "$chart" has version mis-matching: in repo is "$repover" but in addon is "$version"
Copy link
Member

Choose a reason for hiding this comment

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

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants