Skip to content

Commit

Permalink
chore(bors): merge pull request #593
Browse files Browse the repository at this point in the history
593: Fix chart update r=tiagolobocastro a=tiagolobocastro

<!

Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Jan 10, 2025
2 parents 399c964 + 5c00be6 commit 1f4f1ed
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/release-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ jobs:
run: |
tag="${{ github.ref_name }}"
BASE_REF="${{ github.event.base_ref }}"
BRANCH="${BASE_REF#refs/heads/}"
if [ -n "$BASE_REF" ]; then
BRANCH="${BASE_REF#refs/heads/}"
else
BRANCH="$(nix-shell --pure --run "./scripts/helm/find-released-branch.sh "$tag"" ./scripts/helm/shell.nix)"
fi
echo "BASE_BRANCH=$BRANCH" >> $GITHUB_ENV
nix-shell --pure --run "./scripts/helm/publish-chart-yaml.sh --released "$tag" --released-branch "$BRANCH"" ./scripts/helm/shell.nix
nix-shell --pure --run "SKIP_GIT=1 ./scripts/helm/generate-readme.sh" ./scripts/helm/shell.nix
- name: Create Pull Request
Expand All @@ -73,7 +79,7 @@ jobs:
signoff: true
delete-branch: true
branch-suffix: "random"
base: ${{ github.event.base_ref }}
base: ${{ env.BASE_BRANCH }}
token: ${{ secrets.ORG_CI_GITHUB }}
- name: Approve Pull Request by CI Bot
if: ${{ steps.cpr.outputs.pull-request-number }}
Expand Down
6 changes: 3 additions & 3 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.7.2
version: 2.7.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.7.2"
appVersion: "2.7.3"

dependencies:
- name: crds
version: 2.7.2
version: 2.7.3
condition: crds.enabled
- name: etcd
repository: https://charts.bitnami.com/bitnami
Expand Down
4 changes: 2 additions & 2 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Mayastor Helm chart for Kubernetes

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

## Installation Guide

Expand Down Expand Up @@ -54,7 +54,7 @@ This removes all the Kubernetes components associated with the chart and deletes

| Repository | Name | Version |
|------------|------|---------|
| | crds | 2.7.2 |
| | crds | 2.7.3 |
| https://charts.bitnami.com/bitnami | etcd | 8.6.0 |
| https://grafana.github.io/helm-charts | loki-stack | 2.9.11 |
| https://jaegertracing.github.io/helm-charts | jaeger-operator | 2.50.1 |
Expand Down
2 changes: 1 addition & 1 deletion chart/charts/crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: crds
version: 2.7.2
version: 2.7.3
description: |
A Helm chart that collects CustomResourceDefinitions (CRDs) from Mayastor.
2 changes: 1 addition & 1 deletion chart/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository:
name: mayastor
chart:
name: mayastor
version: 2.7.2
version: 2.7.3
values: "-- generate from values file --"
valuesExample: "-- generate from values file --"
prerequisites:
Expand Down
55 changes: 55 additions & 0 deletions scripts/helm/find-released-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

SCRIPTDIR="$(dirname "$(realpath "${BASH_SOURCE[0]:-"$0"}")")"
ROOTDIR="$SCRIPTDIR/../.."

source "$ROOTDIR/scripts/utils/log.sh"

set -euo pipefail

# Check if the given branch matches the tag
# Example:
# release/2.7 matches tag v2.7.2, v2.7.2-rc.4, etc..
# release/2.7 does not match tag v2.6.0, etc...
tag_matches_branch() {
local tag="${1#v}"
local release_branch="$2"

branch_version="${release_branch#release/}"
if ! [[ "$branch_version" =~ ^[0-9]+.[0-9]+$ ]]; then
return 1
fi

if ! [[ "$tag" = "$branch_version"* ]]; then
return 1
fi
}

# For the given tag, find the branch which is compatible
# See tag_matches_branch for more information.
find_released_branch() {
local tag="$1"
local branches=$(git branch -r --contains "$TAG" --points-at "$TAG" --format "%(refname:short)" 2>/dev/null)
local branch=""

for release_branch in $branches; do
release_branch=${release_branch#origin/}
if tag_matches_branch "$TAG" "$release_branch"; then
if [ -n "$branch" ]; then
log_fatal "Multiple branches matched!"
fi
branch="$release_branch"
fi
done

echo "$branch"
}

TAG="$1"
BRANCH="$(find_released_branch "$TAG")"

if [ -z "$BRANCH" ]; then
log_fatal "Failed to find matching released branch for tag '$TAG'"
fi

echo "$BRANCH"

0 comments on commit 1f4f1ed

Please sign in to comment.