Skip to content

Commit

Permalink
chore: implement release version validation and file-filter, improve …
Browse files Browse the repository at this point in the history
…release docs

[skip ci]
  • Loading branch information
Michele Mancioppi committed Feb 17, 2023
1 parent 11b3860 commit e59df2d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .github/file-filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# To be used in conjunction with the https://github.com/dorny/paths-filter GitHub action

new-release:
- VERSION
44 changes: 22 additions & 22 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: build-and-test
on:
push:
branches: [ main ]

pull_request:

jobs:
Expand All @@ -21,16 +22,34 @@ jobs:
run: |
make test
release:
check-should-release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check whether we need to release
id: release-check
uses: dorny/paths-filter@v2
with:
filters: .github/file-filters.yaml
outputs:
do-release: steps.release-check.outputs.new-release

release:
if: github.ref == 'refs/heads/main' && needs.check-should-release.outputs.do-release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # We push only if we built from main
needs:
- check-should-release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1 # We do not need the git history
fetch-depth: 2 # We need this commit and the previous to check validity of version change
- name: Validate version change
run: ./.github/workflows/scripts/validate_version_increment.sh
- name: Setup Go
uses: actions/setup-go@v3
with:
Expand Down Expand Up @@ -92,22 +111,3 @@ jobs:
with:
charts_dir: deploy/helm
install_dir: tools/
# - name: Package Helm chart
# run: |
# mkdir -p dist/
# helm package ./deploy/helm --version "${{ steps.read_version.outputs.version }}.0.0" --app-version "${{ steps.read_version.outputs.version }}" --destination dist/
# - name: Create GitHub release
# run: |
# ghr -t "${GITHUB_TOKEN}" -u "${GITHUB_REPOSITORY_OWNER}" -r lumigo-kubernetes-operator -n "${RELEASE_TAG}" --replace "${RELEASE_TAG}" dist/
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# RELEASE_TAG: v${{ steps.read_version.outputs.version }}
# - name: Publish Helm chart
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: ${{ secrets.AWS_REGION }}
# run: |
# helm repo add stable-lumigo-operator s3://lumigo-kubernetes-operator-helm/stable/lumigo-operator/
# helm repo update stable-lumigo-operator
# helm s3 push "./dist/lumigo-operator-${{ steps.read_version.outputs.version }}.0.0.tgz" stable-lumigo-operator
12 changes: 12 additions & 0 deletions .github/workflows/scripts/validate_version_increment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

previous_version=$(git show HEAD~1:VERSION)
current_version=$(git show HEAD:VERSION)

if [[ $((current_version)) == $((previous_version+1)) ]]
then
exit 0
else
echo "Version '${current_version}' is not a linear increment from the previous '${previous_version}' version; expected new version: '$((previous_version+1))'"
exit 1
fi
15 changes: 13 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# How to release the Lumigo Kubernetes Operator
# Releasing the Lumigo Kubernetes Operator

Push a commit incrementing linearly the version in the [VERSION](./VERSION) file.
## How to trigger a new release

Push a commit to the `main` branch that increments linearly the version in the [VERSION](./VERSION) file.

## Release process

The [build and release workflow](./.github/workflows/build-test-release.yml) will publish:

1. **Container images:** Build the [`lumigo-kubernetes-operator`](https://gallery.ecr.aws/lumigo/lumigo-kubernetes-operator) and [`lumigo-kubernetes-telemetry-proxy`](https://gallery.ecr.aws/lumigo/lumigo-kubernetes-telemetry-proxy) images, and push them with the new version as tag to the public Amazon ECR repositories.
1. **Helm chart defaults:** The new version is set as chart and app version in the [chart metadata](./deploy/helm/Chart.yaml); the new version is set as default tag in the [chart default values](./deploy/helm/values.yaml).
1. **Git tag and GitHub release:** Create a new GitHub release that has the new Helm chart tarball attached as artifact.
1. **Helm repository:** Update the index of the Helm repository hosted as GitHub Pages in the [`gh-pages` branch](https://github.com/lumigo-io/lumigo-kubernetes-operator/tree/gh-pages) will be automatically updated, pointing at the Helm chart tarball attached to the newly-created release.

0 comments on commit e59df2d

Please sign in to comment.