-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare CI for our internal release train (#828)
* Drone: trigger on weekly release branches * Update the image-tag to include the branch name on non-tags * tools/image-tag: use bash This requires bash to be installed in the alpine/git image docker run --rm -it --entrypoint /bin/sh alpine/git /git # bash /bin/sh: bash: not found /git # apk --update --no-cache add bash fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz (1/2) Installing readline (8.1.0-r0) (2/2) Installing bash (5.1.0-r0) Executing bash-5.1.0-r0.post-install Executing busybox-1.32.1-r6.trigger OK: 27 MiB in 33 packages /git # ^C * Add CHANGELOG entry
- Loading branch information
Showing
3 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
#!/usr/bin/env sh | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
SHA="$(git rev-parse --short HEAD)" | ||
WIP=$(git diff --quiet || echo '-WIP') | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#/#-#g') | ||
# When 7 chars are not enough to be unique, git automatically uses more. | ||
# We are forcing to 7 here, as we are doing for grafana/grafana as well. | ||
SHA=$(git rev-parse --short=7 HEAD | head -c7) | ||
|
||
# If not a tag, use branch-hash else use tag | ||
TAG=$((git describe --exact-match 2> /dev/null || echo "") | sed 's/v//g') | ||
# If tag, use tag | ||
TAG=$( (git describe --exact-match 2> /dev/null || echo "") | sed 's/v//g') | ||
if [ -z "$TAG" ] | ||
then | ||
echo ${SHA} | ||
echo ${BRANCH}-${SHA}${WIP} | ||
else | ||
echo ${TAG} | ||
fi |