Skip to content

Commit

Permalink
Create v2 release job (#831)
Browse files Browse the repository at this point in the history
* WIP

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Start work on a v2 release job

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* More work on the action

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix helm package command

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* not addign the changelog

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Bump version to 2.0.0-rc.1 and work more on the release action

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix workload and example yaml linting

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Update attributes to find the examples directory correctly

Signed-off-by: Pete Wall <pete.wall@grafana.com>

---------

Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall authored Oct 31, 2024
1 parent 3bcd8ef commit a63dbb3
Show file tree
Hide file tree
Showing 38 changed files with 155 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
examples/** linguist-generated=true
examples/README.md linguist-generated=false
examples/**/README.md linguist-generated=false
examples/**/values.yaml linguist-generated=false
charts/**/docs/examples/** linguist-generated=true
charts/**/docs/examples/README.md linguist-generated=false
charts/**/docs/examples/**/README.md linguist-generated=false
charts/**/docs/examples/**/values.yaml linguist-generated=false
2 changes: 1 addition & 1 deletion .github/workflows/helm-release-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
CR_INDEX_PATH: "${{ github.workspace }}/.cr-index"
CR_PACKAGE_PATH: "${{ github.workspace }}/.cr-release-packages"
CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
CR_VERSION: "1.5.0"
CR_VERSION: "1.6.1"
jobs:
setup:
runs-on: ubuntu-latest
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
name: Release Helm chart
# yamllint disable-line rule:truthy
on:
workflow_dispatch:

env:
BIN_PATH: bin
PACKAGE_PATH: package
INDEX_PATH: index

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout grafana/k8s-monitoring-helm
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

- name: Checkout grafana/helm-charts
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: grafana/helm-charts
path: helm-charts
token: "${{ secrets.GH_BOT_ACCESS_TOKEN }}"

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Install CR tool
run: |
mkdir "${BIN_PATH}"
mkdir "${PACKAGE_PATH}"
mkdir "${INDEX_PATH}"
crVersion=$(gh release list --repo helm/chart-releaser --exclude-pre-releases --json tagName --jq '.[0].tagName' | sed 's/v//')
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${crVersion}/chart-releaser_${crVersion}_linux_amd64.tar.gz"
tar -xzf cr.tar.gz -C "${BIN_PATH}"
rm -f cr.tar.gz
- name: Configure Git
run: |
cd source
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
cd ../helm-charts
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Parse Chart.yaml
id: parse-chart
working-directory: source
run: |
name="$(yq ".name" charts/k8s-monitoring/Chart.yaml)"
version="$(yq ".version" charts/k8s-monitoring/Chart.yaml)"
{
echo "description=$(yq ".description" charts/k8s-monitoring/Chart.yaml)"
echo "version=${version}"
echo "tagVersion=v${version}"
echo "packageName=${name}-${version}"
} >> "${GITHUB_OUTPUT}"
- name: Parse version
id: parse-version
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ steps.parse-chart.outputs.version }}

- name: Create Helm package
working-directory: source
run: |
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
helm repo add opencost https://opencost.github.io/opencost-helm-chart
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm package charts/k8s-monitoring --destination "../${PACKAGE_PATH}"
- name: Create release on grafana/k8s-monitoring-helm
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.parse-chart.outputs.tagVersion }}
repository: grafana/k8s-monitoring-helm
tag_name: ${{ steps.parse-chart.outputs.tagVersion }}
prerelease: ${{ steps.parse-version.outputs.prerelease != '' }}
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
generate_release_notes: true
files: ${{ env.PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz
fail_on_unmatched_files: true

# Note that this creates a release in grafana/helm-charts GitHub Repository with a new tag.
# The tag name in grafana/helm-charts is <package>-<version>, while the
# tag name for grafana/k8s-monitoring-helm is <version>.
- name: Create release on grafana/helm-charts
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.parse-chart.outputs.packagename }}
repository: grafana/helm-charts
tag_name: ${{ steps.parse-chart.outputs.packagename }}
prerelease: ${{ steps.parse-version.outputs.prerelease != '' }}
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
body: |
${{ steps.parse-chart.outputs.desc }}
Source commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse-chart.outputs.tagname }}
files: ${{ env.PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz
fail_on_unmatched_files: true

- name: Update Helm repository index
working-directory: helm-charts
env:
CR_OWNER: grafana
CR_GIT_REPO: helm-charts
CR_PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
CR_SKIP_EXISTING: true
CR_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
run: |
"${BIN_PATH}/cr" index --index-path "${INDEX_PATH}" --push
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: application
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg
sources:
- https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/k8s-monitoring
version: 2.0.0-alpha.1
version: 2.0.0-rc.1
appVersion: 2.0.0
maintainers:
- email: pete.wall@grafana.com
Expand Down
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# k8s-monitoring

![Version: 2.0.0-alpha.1](https://img.shields.io/badge/Version-2.0.0--alpha.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)
![Version: 2.0.0-rc.1](https://img.shields.io/badge/Version-2.0.0--rc.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)

Capture all telemetry data from your Kubernetes cluster.

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion charts/k8s-monitoring/docs/examples/auth/sigv4/output.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a63dbb3

Please sign in to comment.