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

feat: support chart release-notes or changelog #137

Merged
merged 3 commits into from
Oct 28, 2021

Conversation

aabouzaid
Copy link
Contributor

@aabouzaid aabouzaid commented Oct 3, 2021

At the moment there is no way to set charts release-notes/changelog.

This PR adds an option to set the charts release-notes/changelog by looking for release-notes.md file.

  • If the release-notes file is there, it will be used, if not, it will use the previous notion (Chart description), so no change in the behaviour.
  • The user is responsible for generating the file, so the generating of the release notes is decoupled from the chart-releaser code.
  • This PR should address the feature request in the issue no. Feature: Changelog #118
  • If the feature is accepted, I will add the unit tests and update the docs.

@helm-bot helm-bot added the size/S label Oct 3, 2021
@aabouzaid aabouzaid force-pushed the add-release-notes-option branch from 543a3d9 to 518085e Compare October 3, 2021 15:04
@aabouzaid aabouzaid mentioned this pull request Oct 3, 2021
@aabouzaid
Copy link
Contributor Author

Hi @unguiculus @scottrigby
Could you please approve the CI workflow? And what do you think in general? Should I go with it?

aabouzaid referenced this pull request in camunda-community-hub/camunda-7-community-helm Oct 20, 2021
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

thanks for this PR, can you add some tests?

@helm-bot helm-bot added size/M and removed size/S labels Oct 24, 2021
@aabouzaid aabouzaid force-pushed the add-release-notes-option branch from 837f02c to b7845bf Compare October 24, 2021 01:31
@aabouzaid aabouzaid requested a review from cpanato October 24, 2021 01:46
@aabouzaid
Copy link
Contributor Author

@cpanato The unit tests and docs have been added.
Thanks.

@cpanato cpanato requested a review from unguiculus October 24, 2021 14:13
Copy link
Member

@cpanato cpanato 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 a comment that i think need to be empty and not a filename prefilled

cr/cmd/upload.go Outdated Show resolved Hide resolved
@aabouzaid aabouzaid force-pushed the add-release-notes-option branch from 6cc2e1f to aa5ae36 Compare October 24, 2021 15:09
@aabouzaid aabouzaid requested a review from cpanato October 24, 2021 15:26
README.md Outdated Show resolved Hide resolved
@aabouzaid aabouzaid force-pushed the add-release-notes-option branch from aa5ae36 to 16090e3 Compare October 25, 2021 22:23
@aabouzaid aabouzaid requested a review from cpanato October 25, 2021 22:25
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

lgtm

@aabouzaid
Copy link
Contributor Author

@cpanato that's great, thanks a lot 👍

@cpanato cpanato merged commit 4eb598f into helm:main Oct 28, 2021
@stevehipwell
Copy link

@aabouzaid looking at the code I can't see any logic to pick the correct notes out of a CHANGELOG, is this correct or have I missed something?

@aabouzaid
Copy link
Contributor Author

@stevehipwell That's correct, it doesn't pick from a file, it uses the entire file (so that file should be single release notes, not the changelog that has all releases notes)

So whatever in the file will be used. The user is responsible to put what they need there.

Putting any logic to select from the file will couple chart-releaser with a certain format, and there are a lot of them there.

@stevehipwell
Copy link

@aabouzaid how would you expect this to work then? I guess a local workflow would be to copy part of your changelog to a temp file, but how would it work via automation?

Wouldn't picking a CHANGELOG format such as Keep a Changelog have been a better bet here? This would work with automation (specifically the GitHub action) and would also let you capture the Artifact Hub change annotations in index.yaml as part of the same process.

@chgl
Copy link

chgl commented Nov 8, 2021

@stevehipwell as an example: I've implemented one approach here: https://github.com/chgl/charts/blob/master/.github/generate-chart-changelogs.sh where a changelog.md is generated from the chart.yaml's artifacthub annotations as part of the release process.

@stevehipwell
Copy link

@chgl the chart annotations are transient so not the best starting point. IMHO this would be best driven from a structured CHANGELOG.

@aabouzaid
Copy link
Contributor Author

@stevehipwell Most if not all tools I saw that generates the CHANGELOG file are able to generate the changelog for a certain tag.

I use git-chglog with Keep a Changelog format, and here is how it generates the latest version release notes.

Also I use that file to update ArtifactHub annotation in the Chart.yaml file.

And as you can see from @chgl comment, everyone makes it differently, and adding the logic to chart-releaser will make it harder for many use cases.

@stevehipwell
Copy link

Thanks for your example @aabouzaid. However I think for generic use a workflow needs to work without needing to add repo commits. That said with a couple of small features added this could be supported with minimal additional steps and almost certainly work with the chart-releaser-action too.

  • Allow --release-notes-file (I assume RELEASE_NOTES_FILE works) to be templated or set relative to chart
  • Support merging annotations yaml file into index.yaml before push
    • Can use mindsers/changelog-reader-action to generate this file in CI
    • This wont break signing the chart artefact

@aabouzaid
Copy link
Contributor Author

@stevehipwell it doesn't work that way, unfortunately. If you took a look at the code you will find that the upload command accesses the packaged charts not the source code of the charts.

In the current solution, you don't need to commit the release notes file to git but it should be in the Helm chart archive package (for the same reason, chart-releaser upload works the archived packages, not the source code).

Also, chart-releaser doesn't work with individual charts, it works with any charts in the working path (one or more, it doesn't matter) which means it's not possible to run external commands or Github Actions between each chart upload.


Here is how I do it with the new feature in this PR:
https://github.com/camunda-community-hub/camunda-helm/blob/15e81a3/.github/workflows/release.yaml

Job 1:

  1. Generate the RELEASE-NOTES.md for each chart that will be released.
  2. Stash the generated RELEASE-NOTES.md for all charts.

Job 2:

  1. Unstash RELEASE-NOTES.md for all charts.
  2. Run chart-releaser-action (which will run the whole chart-releaser cycle which includes: "package", "upload", "index" for all released charts).

@stevehipwell
Copy link

@aabouzaid I'm pretty sure that the Artifact Hub code supports annotations in the index as well as in the packaged chart.

I've automated my release markdown notes from a CHANGELOG.md in each chart directory without this feature. But it would be easier using this feature if it supported chart relative paths.

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

Successfully merging this pull request may close these issues.

5 participants