-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add release toolkit to this repository #87
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
95e65f7
Add release toolkit to this repository
bceb5e5
upgrade chart-testing-action
9cd3684
checkout code on the job that test the change log
2eea650
fix change type so changelog is valid
f524632
fetch all commits so rt can calculate versions
12e3afe
change the conditional for running rt
7bf5a77
Lint charts using next-version too
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file is a dictionary used by the [link-dependencies](https://github.com/newrelic/release-toolkit/tree/main/link-dependencies) action. | ||
# Notice that the implementation uses dep.To.ToString that removes the leading v if present. | ||
dictionary: | ||
# TODO: Unable to link dependency for Power DNS because it uses a weird changelog URL scheme: | ||
# https://doc.powerdns.com/authoritative/changelog/4.9.html#change-4.9.1 | ||
# txqueuelen/powerdns-docker: "https://github.com/txqueuelen/powerdns-docker/releases/tag/{{.To}}" | ||
|
||
external-dns/external-dns: "https://github.com/kubernetes-sigs/external-dns/releases/tag/v{{.To}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,6 @@ name: Lint and test PR | |
on: pull_request | ||
|
||
jobs: | ||
chart-lint: | ||
name: Lint Helm charts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install helm/chart-testing | ||
uses: helm/[email protected] | ||
- name: Lint charts | ||
run: ct --config .github/ct.yaml lint --all | ||
|
||
chart-unittest: | ||
name: Unit test Helm charts | ||
runs-on: ubuntu-latest | ||
|
@@ -34,13 +21,77 @@ jobs: | |
fi | ||
done | ||
|
||
changelog-checks: | ||
name: Test changelog correctness and get next-version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
is-empty: ${{ steps.empty.outputs.is-empty }} | ||
is-held: ${{ steps.held.outputs.is-held }} | ||
skip-release: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
next-version: ${{ steps.version.outputs.next-version }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Validate that the markdown is correct | ||
uses: newrelic/release-toolkit/validate-markdown@v1 | ||
- name: Generate YAML | ||
uses: newrelic/release-toolkit/generate-yaml@v1 | ||
with: | ||
excluded-dirs: .github | ||
excluded-files: README.md | ||
exit-code: "0" | ||
- name: Check if the release is empty | ||
id: empty | ||
uses: newrelic/release-toolkit/is-empty@v1 | ||
- name: Check if the release is held | ||
id: held | ||
uses: newrelic/release-toolkit/is-held@v1 | ||
|
||
- name: Link dependencies | ||
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }} | ||
uses: newrelic/release-toolkit/link-dependencies@v1 | ||
with: | ||
dictionary: .github/rt-dictionary.yaml | ||
|
||
- name: Calculate next version | ||
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }} | ||
id: version | ||
uses: newrelic/release-toolkit/next-version@v1 | ||
|
||
chart-lint: | ||
name: Lint Helm charts | ||
runs-on: ubuntu-latest | ||
needs: | ||
# Lint charts using the next version. | ||
- changelog-checks | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install helm/chart-testing | ||
uses: helm/[email protected] | ||
# Change version of the Helm chart to the next one so test upgrade path | ||
- name: Set chart version to rt's next-version | ||
run: | | ||
yq -i '.version = "${{ needs.changelog-checks.outputs.next-version }}"' charts/stateless-dns/Chart.yaml | ||
- name: Lint charts | ||
run: ct --config .github/ct.yaml lint --all | ||
|
||
chart-install: | ||
name: Installation test for Helm charts | ||
runs-on: ubuntu-latest | ||
needs: | ||
# This test is expensive so only run it when cheap tests pass: | ||
# This test is expensive so only run when cheap tests pass. | ||
- chart-lint | ||
- chart-unittest | ||
# To test the upgrade path we need the previous and next version. | ||
- changelog-checks | ||
if: ${{ needs.changelog-checks.outputs.skip-release != 'true' }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
@@ -55,9 +106,14 @@ jobs: | |
driver: docker | ||
start args: "--container-runtime=containerd" | ||
|
||
# Change version of the Helm chart to the next one so test upgrade path | ||
- name: Set chart version to rt's next-version | ||
run: | | ||
yq -i '.version = "${{ needs.changelog-checks.outputs.next-version }}"' charts/stateless-dns/Chart.yaml | ||
|
||
# Test chart installation | ||
- name: Install helm/chart-testing | ||
uses: helm/chart-testing-action@v2.4.0 | ||
uses: helm/chart-testing-action@v2.6.1 | ||
- name: Test charts' installation path | ||
run: | | ||
ct install --all \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,82 @@ | ||
# Publish chart as OCI image to GitHub registry. Version is automatically gathered from the tag name. | ||
# For this workflow to work, GITHUB_TOKEN needs to be configured with write permissions. | ||
# Additionally, the repository must be granted access in the package settings. | ||
|
||
name: Publish chart | ||
|
||
on: | ||
release: | ||
types: [ released ] | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
release: | ||
name: Publish chart to OCI registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Create release-toolkit data file and hydrate it. | ||
- name: Generate changelog YAML | ||
uses: newrelic/release-toolkit/generate-yaml@v1 | ||
with: | ||
excluded-dirs: .github | ||
excluded-files: README.md | ||
exit-code: "0" | ||
- name: Link dependencies | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
uses: newrelic/release-toolkit/link-dependencies@v1 | ||
with: | ||
dictionary: .github/rt-dictionary.yaml | ||
|
||
# Check if we have something to release and if the release is not blocked. | ||
- name: Check if the release is empty | ||
id: empty | ||
uses: newrelic/release-toolkit/is-empty@v1 | ||
- name: Check if the release is held | ||
id: held | ||
uses: newrelic/release-toolkit/is-held@v1 | ||
|
||
# Calculate next-version and generate change logs | ||
- name: Calculate next version | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
id: version | ||
uses: newrelic/release-toolkit/next-version@v1 | ||
- name: Generate release notes | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
uses: newrelic/release-toolkit/render@v1 | ||
- name: Update CHANGELOG.md | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
uses: newrelic/release-toolkit/update-markdown@v1 | ||
with: | ||
next-version: ${{ steps.next-version.outputs.version }} | ||
|
||
# Commit to main branch and push changes. Then create a release. | ||
- name: Commit and tag release | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
run: | | ||
git add CHANGELOG.md | ||
git commit -m "[no ci] Automatic ${{ steps.next-version.outputs.next-version }} release" | ||
git push | ||
gh release create "${{ steps.next-version.outputs.next-version }}" -F CHANGELOG.partial.md | ||
|
||
# Login to GitHub Packages to upload the chart to the OCI repository. | ||
- name: Helm login | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
run: | | ||
echo "${{ secrets.GITHUB_TOKEN }}" | \ | ||
helm registry login ghcr.io \ | ||
--username "$GITHUB_REPOSITORY_OWNER" \ | ||
--password-stdin | ||
- name: Helm package | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
run: | | ||
helm package charts/stateless-dns -u --version "${GITHUB_REF_NAME#v}" | ||
helm package charts/stateless-dns -u --version "${{ steps.next-version.outputs.version }}" | ||
- name: Helm push | ||
if: ${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }} | ||
run: | | ||
helm push \ | ||
"stateless-dns-${GITHUB_REF_NAME#v}.tgz" \ | ||
"oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts" | ||
"stateless-dns-${{ steps.next-version.outputs.version }}.tgz" \ | ||
"oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/pdns-stateless" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Release toolkit | ||
/changelog.yaml | ||
/CHANGELOG.partial.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Changelog | ||
|
||
## Unreleased | ||
|
||
### Note | ||
|
||
All the previous release contain no changelog as it was no automation. | ||
|
||
I am solving this with this PR/release/automation that automates the | ||
generation of change logs and releases. | ||
|
||
I am leveraging this 0ver to do a breaking change. I am changing the | ||
URL for this chart from oci://ghcr.io/txqueuelen/charts to | ||
oci://ghcr.io/txqueuelen/pdns-stateless. | ||
|
||
It seemed that is awesome to have all charts on the same path and loved | ||
that Github supported it but I found that is hard to follow the origin | ||
of a chart. Users expect to have the chart in a repository called | ||
`charts`. | ||
|
||
This breaking change should not affect too much as almost no user is | ||
using this release note is a way of documenting the changes. | ||
|
||
Luckily there are only a few 0ver releases from here once we merge all | ||
dependencies that need to be upgraded and make the last changes before | ||
creating the v1 release :D | ||
|
||
### Enhancement | ||
- Automatic dependency upgrade and release system |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be worth raising upstream. The code is already using templates, and is already importing the semver package, so it should be a matter of a couple lines of code to expose the
major
andminor
functions to the template, such that you can do something like:Hopefully we can find a rt maintainer that can listen to this request 🤞🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot open an issue from my personal laptop because I am redirected to my company's Okta. I know release-toolkit is open source but 🤷
I'll open a ticket tomorrow morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newrelic/release-toolkit#200