Skip to content

Commit

Permalink
Prepare CI for our internal release train (#828)
Browse files Browse the repository at this point in the history
* 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
jvrplmlmn authored Jul 20, 2021
1 parent 99217c5 commit 1795cf1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
- name: image-tag
image: alpine/git
commands:
- apk --update --no-cache add bash
- git fetch origin --tags
- echo $(./tools/image-tag) > .tags

Expand All @@ -36,6 +37,8 @@ trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/heads/r? # For weekly release
- refs/heads/r?? # For weekly release

---
## AMD64 ##
Expand All @@ -50,6 +53,7 @@ steps:
- name: image-tag
image: alpine/git
commands:
- apk --update --no-cache add bash
- git fetch origin --tags
- echo $(./tools/image-tag)-amd64 > .tags

Expand Down Expand Up @@ -90,6 +94,8 @@ trigger:
ref:
- refs/heads/main
- refs/tags/v*
- refs/heads/r? # For weekly release
- refs/heads/r?? # For weekly release

---
## ARM64 ##
Expand All @@ -104,6 +110,7 @@ steps:
- name: image-tag
image: alpine/git
commands:
- apk --update --no-cache add bash
- git fetch origin --tags
- echo $(./tools/image-tag)-arm64 > .tags

Expand Down Expand Up @@ -144,6 +151,8 @@ trigger:
ref:
- refs/heads/main
- refs/tags/v*
- refs/heads/r? # For weekly release
- refs/heads/r?? # For weekly release

---
## MANIFEST ##
Expand All @@ -158,6 +167,7 @@ steps:
- name: image-tag
image: alpine/git
commands:
- apk --update --no-cache add bash
- git fetch origin --tags
- echo $(./tools/image-tag) > .tags

Expand Down Expand Up @@ -189,6 +199,8 @@ trigger:
ref:
- refs/heads/main
- refs/tags/v*
- refs/heads/r? # For weekly release
- refs/heads/r?? # For weekly release

---
kind: secret
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [ENHANCEMENT] Add `-config.expand-env` cli flag to support environment variables expansion in config file. [#796](https://github.com/grafana/tempo/pull/796) (@Ashmita152)
* [ENHANCEMENT] Emit traces for ingester flush operations. [#812](https://github.com/grafana/tempo/pull/812) (@bboreham)
* [ENHANCEMENT] Add retry middleware in query-frontend. [#814](https://github.com/grafana/tempo/pull/814) (@kvrhdn)
* [CHANGE] Docker images are now prefixed by their branch name [#828](https://github.com/grafana/tempo/pull/828) (@jvrplmlmn)

## v1.0.1

Expand Down
16 changes: 11 additions & 5 deletions tools/image-tag
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

0 comments on commit 1795cf1

Please sign in to comment.