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

Modify sed command matching rule while updating version in Chart.yaml #194

Merged
merged 2 commits into from
May 17, 2021

Conversation

heanlan
Copy link
Contributor

@heanlan heanlan commented May 13, 2021

This PR is to fix the error in upload-release-assets job.

The change is made in the section where we update the version value in Chart.yaml by the value in "go-ipfix/VERSION".

In the original script, the sed command will match string in the form: vx.x.x-dev. Now changed to match with vx.x.x.
When I wrote the script, the version in "go-ipfix/VERSION" is v0.6.0-dev, so I thought that is the form I need to match. I didn't realize the version will be changed to the form like v0.5.1 before release. Sorry about creating the issue.

@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #194 (be12e50) into main (a71ee05) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #194   +/-   ##
=======================================
  Coverage   78.66%   78.66%           
=======================================
  Files          17       17           
  Lines        2133     2133           
=======================================
  Hits         1678     1678           
  Misses        304      304           
  Partials      151      151           
Flag Coverage Δ
integration-tests 57.75% <ø> (-1.11%) ⬇️
unit-tests 78.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

zyiou
zyiou previously approved these changes May 13, 2021
Copy link
Contributor

@zyiou zyiou left a comment

Choose a reason for hiding this comment

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

LGTM.
This PR is to fix failure for uploading assets when we release v0.5.1. @srikartati I think we need to release v0.5.2 for this fix, right?

@heanlan
Copy link
Contributor Author

heanlan commented May 13, 2021

I also think a new release will be helpful because there is a PR on Antrea with changes in flow-visibility documentation needs ipfix-collector.yaml showing in released assets.

@heanlan heanlan marked this pull request as draft May 13, 2021 23:51
@heanlan heanlan changed the title Align version in Chart.yaml with the value in VERSION Modify sed command matching rule while updating version in Chart.yaml May 14, 2021
@heanlan heanlan marked this pull request as ready for review May 14, 2021 00:33
@srikartati
Copy link
Contributor

LGTM.
This PR is to fix failure for uploading assets when we release v0.5.1. @srikartati I think we need to release v0.5.2 for this fix, right?

Sure, we can create a new tag for this.

@@ -116,7 +116,7 @@ fi

if [ "$MODE" == "release" ]; then
# update the Chart version
version=$(sed -n 's/v\(.*\)-dev/\1/p' $THIS_DIR/../VERSION)
version=$(sed -n 's/v\(.*\)/\1/p' $THIS_DIR/../VERSION)
Copy link
Contributor

Choose a reason for hiding this comment

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

In the case of "dev" mode, what version would you use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. release mode
    I realized line 119-121 actually make no effect. They are triggered by the release action. The changes to Chart.yaml file will neither go into the "Source Code zip" under "assets" nor the releasing branch.
    If we want to make sure in the Source Code zip, the version is the same with the release tag, I think manually change the file would work, like how we change VERSION. I can't think of a good way to automatically make this change into the source code zip.

  2. dev mode
    As for the dev mode, I can let the script to update it according to VERSION every time we generate manifest, (but if we change VERSION and do not generate manifest right away, the two "version" will not be the same during this time). Or we can also manually change it when we change dev VERSION.

That's to say, in the ideal case, the version in Chart.yaml will always be the same with VERSION in the same branch. Do you think manually change the version is acceptable?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just meant you could have the following line for the dev mode. Just to give an indication for the user if they are using the collector from main branch ToT. Do you see anything wrong?

version=$(sed -n 's/v\(.*\)-dev/\1/p' $THIS_DIR/../VERSION)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will work. What about release? Do we want the version to be the release tag in the source code zip? If so, I think we need to manually change it before release.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused about the manual change. Releases are done on release branch, where the VERSION file is changed before to reflect the tag, so the script should pick the correct tag. Not sure why will the VERSION file be different in the zipped source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. I didn't make it clear. The VERSION file is the same in the branch and the zipped source code. But the modification to Chart.yaml is triggered in this order:
manually create a new release -> upload_release_assets.yml -> generate-manifest-collector.sh -> if [ "$MODE" == "release" ]; then:
so the version in Chart.yaml hasn't been changed before we manually create the new release, before the source code been zipped. I have tested on my branch, in the zipped source code, the version in Chart.yaml is different from the VERSION.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are changing the chart version in the checked-out code in github CI and it's not checked into the branch. Is this the issue?
This version has no significance right? Does it have to be in the format x.x.x? I see that ipfix-collector version in the ToT code is latest.. we only have it's version in release assets. We can just stick with the same if possible.

Copy link
Contributor

@srikartati srikartati May 14, 2021

Choose a reason for hiding this comment

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

I see that it is a must: https://helm.sh/docs/topics/charts/#the-chartyaml-file
Let's just use 0.0.0 and do not change it. I feel changing this manually for every release is cumbersome.

(Edited) Or make a check for Chart.yaml in make manifest to make sure that it coincides with the version in VERSION. Person who is changing the version for release branch will take care of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Let's make it 0.0.0 for now.

Copy link
Contributor

@srikartati srikartati left a comment

Choose a reason for hiding this comment

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

LGTM

@heanlan heanlan merged commit 9b4f91e into vmware:main May 17, 2021
@heanlan heanlan deleted the upload-yaml branch May 17, 2021 18:25
heanlan added a commit to heanlan/go-ipfix that referenced this pull request May 17, 2021
srikartati pushed a commit that referenced this pull request May 18, 2021
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.

4 participants