Skip to content

Commit 6c0c372

Browse files
authored
NO-JIRA Fixes the latest tag fetched when packaging
1 parent 9742cf1 commit 6c0c372

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.cirrus/package.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/bin/bash
22

3-
set -eo pipefail
3+
set -xeo pipefail
44

55
VERSION_SEPERATOR="-"
66
[[ ${CIRRUS_RELEASE:-} != "" ]] && VERSION_SEPERATOR="+"
77

8-
LAST_TAG=$(gh api "/repos/{owner}/{repo}/releases?per_page=2" --jq ".[1].tag_name")
8+
PREVIOUS_RELEASE=$(gh api "/repos/{owner}/{repo}/releases" --jq "[.[] | select(.target_commitish==\"${CIRRUS_BRANCH}\")][1].tag_name")
99

10-
[ -z "$LAST_TAG" ] && LAST_TAG="HEAD" || echo $LAST_TAG
10+
# There MIGHT be a some edge case where PREVIOUS_RELEASE shouldn't be HEAD,
11+
# for example, releasing a patch for non-LTA. To be investigated.
12+
[[ -z "${PREVIOUS_RELEASE}" ]] && PREVIOUS_RELEASE="HEAD" || echo "${PREVIOUS_RELEASE}"
1113

12-
echo $(ct list-changed --since $LAST_TAG)
14+
echo $(ct list-changed --since "${PREVIOUS_RELEASE}" --target-branch "${CIRRUS_BRANCH}")
1315

14-
for chart in $(ct list-changed --since $LAST_TAG); do
16+
for chart in $(ct list-changed --since "${PREVIOUS_RELEASE}" --target-branch "${CIRRUS_BRANCH}"); do
1517
_original_version=$(cat $chart/Chart.yaml | yq '.version' -)
16-
_new_version="$_original_version$VERSION_SEPERATOR$BUILD_NUMBER"
17-
helm dependency build $chart
18-
helm package --version $_new_version $chart
19-
done
18+
_new_version="${_original_version}${VERSION_SEPERATOR}${BUILD_NUMBER}"
19+
helm dependency build "${chart}"
20+
helm package --version "${_new_version}" "${chart}"
21+
done

0 commit comments

Comments
 (0)