Skip to content

Commit 1f4f1ed

Browse files
mayastor-borstiagolobocastro
mayastor-bors
andcommitted
chore(bors): merge pull request #593
593: Fix chart update r=tiagolobocastro a=tiagolobocastro <! Co-authored-by: Tiago Castro <[email protected]>
2 parents 399c964 + 5c00be6 commit 1f4f1ed

File tree

6 files changed

+70
-9
lines changed

6 files changed

+70
-9
lines changed

.github/workflows/release-chart.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ jobs:
5555
run: |
5656
tag="${{ github.ref_name }}"
5757
BASE_REF="${{ github.event.base_ref }}"
58-
BRANCH="${BASE_REF#refs/heads/}"
58+
if [ -n "$BASE_REF" ]; then
59+
BRANCH="${BASE_REF#refs/heads/}"
60+
else
61+
BRANCH="$(nix-shell --pure --run "./scripts/helm/find-released-branch.sh "$tag"" ./scripts/helm/shell.nix)"
62+
fi
63+
echo "BASE_BRANCH=$BRANCH" >> $GITHUB_ENV
64+
5965
nix-shell --pure --run "./scripts/helm/publish-chart-yaml.sh --released "$tag" --released-branch "$BRANCH"" ./scripts/helm/shell.nix
6066
nix-shell --pure --run "SKIP_GIT=1 ./scripts/helm/generate-readme.sh" ./scripts/helm/shell.nix
6167
- name: Create Pull Request
@@ -73,7 +79,7 @@ jobs:
7379
signoff: true
7480
delete-branch: true
7581
branch-suffix: "random"
76-
base: ${{ github.event.base_ref }}
82+
base: ${{ env.BASE_BRANCH }}
7783
token: ${{ secrets.ORG_CI_GITHUB }}
7884
- name: Approve Pull Request by CI Bot
7985
if: ${{ steps.cpr.outputs.pull-request-number }}

chart/Chart.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 2.7.2
19+
version: 2.7.3
2020

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

2727
dependencies:
2828
- name: crds
29-
version: 2.7.2
29+
version: 2.7.3
3030
condition: crds.enabled
3131
- name: etcd
3232
repository: https://charts.bitnami.com/bitnami

chart/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Mayastor Helm chart for Kubernetes
44

5-
![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)
5+
![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)
66

77
## Installation Guide
88

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

5555
| Repository | Name | Version |
5656
|------------|------|---------|
57-
| | crds | 2.7.2 |
57+
| | crds | 2.7.3 |
5858
| https://charts.bitnami.com/bitnami | etcd | 8.6.0 |
5959
| https://grafana.github.io/helm-charts | loki-stack | 2.9.11 |
6060
| https://jaegertracing.github.io/helm-charts | jaeger-operator | 2.50.1 |

chart/charts/crds/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: crds
3-
version: 2.7.2
3+
version: 2.7.3
44
description: |
55
A Helm chart that collects CustomResourceDefinitions (CRDs) from Mayastor.
66

chart/doc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository:
88
name: mayastor
99
chart:
1010
name: mayastor
11-
version: 2.7.2
11+
version: 2.7.3
1212
values: "-- generate from values file --"
1313
valuesExample: "-- generate from values file --"
1414
prerequisites:

scripts/helm/find-released-branch.sh

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPTDIR="$(dirname "$(realpath "${BASH_SOURCE[0]:-"$0"}")")"
4+
ROOTDIR="$SCRIPTDIR/../.."
5+
6+
source "$ROOTDIR/scripts/utils/log.sh"
7+
8+
set -euo pipefail
9+
10+
# Check if the given branch matches the tag
11+
# Example:
12+
# release/2.7 matches tag v2.7.2, v2.7.2-rc.4, etc..
13+
# release/2.7 does not match tag v2.6.0, etc...
14+
tag_matches_branch() {
15+
local tag="${1#v}"
16+
local release_branch="$2"
17+
18+
branch_version="${release_branch#release/}"
19+
if ! [[ "$branch_version" =~ ^[0-9]+.[0-9]+$ ]]; then
20+
return 1
21+
fi
22+
23+
if ! [[ "$tag" = "$branch_version"* ]]; then
24+
return 1
25+
fi
26+
}
27+
28+
# For the given tag, find the branch which is compatible
29+
# See tag_matches_branch for more information.
30+
find_released_branch() {
31+
local tag="$1"
32+
local branches=$(git branch -r --contains "$TAG" --points-at "$TAG" --format "%(refname:short)" 2>/dev/null)
33+
local branch=""
34+
35+
for release_branch in $branches; do
36+
release_branch=${release_branch#origin/}
37+
if tag_matches_branch "$TAG" "$release_branch"; then
38+
if [ -n "$branch" ]; then
39+
log_fatal "Multiple branches matched!"
40+
fi
41+
branch="$release_branch"
42+
fi
43+
done
44+
45+
echo "$branch"
46+
}
47+
48+
TAG="$1"
49+
BRANCH="$(find_released_branch "$TAG")"
50+
51+
if [ -z "$BRANCH" ]; then
52+
log_fatal "Failed to find matching released branch for tag '$TAG'"
53+
fi
54+
55+
echo "$BRANCH"

0 commit comments

Comments
 (0)