-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix_3811: send semver version in api/stattus/buildinfo for cloud deployments #4110
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This workflow automatically updates VERSION file in repo if any change is pushed to main branch. It performs below steps: | ||
# 1. Checks out the repo with depth 0 for full history. | ||
# 2. Runs make command to update VERSION file with the latest tag | ||
# 3. Commit and push updated VERSION file | ||
|
||
name: Update VERSION File | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
update-version-file: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update VERSION file | ||
run: make update-version | ||
|
||
- name: Commit and push changes | ||
run: | | ||
if [ -n "$(git status --porcelain VERSION)" ]; then | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add VERSION | ||
git commit -m "Update VERSION file to latest tag" | ||
git push | ||
else | ||
echo "No changes to VERSION file." | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v2.6.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,27 @@ set -o errexit | |
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
|
||
is_valid_semver() { | ||
local version=$1 | ||
# regex taken from https://semver.org/ | ||
if [[ $version =~ ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ ]] ;then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
# Check if there is a VERSION file | ||
if [ -f "${REPO_ROOT}/VERSION" ]; then | ||
VERSION=$(cat "${REPO_ROOT}/VERSION" ) | ||
if is_valid_semver "$VERSION"; then | ||
echo "$VERSION" | ||
exit 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I believe that changing this script will update the version as expected b/c of this line: https://github.com/grafana/tempo/blob/main/Makefile#L50 However I think it will also change the output of the script as used here: https://github.com/grafana/tempo/blob/main/.drone/drone.yml#L12 which I'm pretty sure is how our docker images are tagged: https://hub.docker.com/r/grafana/tempo/tags @zalegrala do you know off the top of your head if this is how it works? |
||
fi | ||
fi | ||
|
||
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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ie-pham do you think this will work with our latest security changes to GHA?
i'll admit i'm not sure where the creds are that allow this to work?