forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
196 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
# This script was soruced here: https://github.com/fmahnke/shell-semver and had the following license: | ||
|
||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2014 Fritz Mahnke | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
|
||
# Increment a version string using Semantic Versioning (SemVer) terminology. | ||
|
||
# Parse command line options. | ||
|
||
while getopts ":Mmp" Option | ||
do | ||
case $Option in | ||
M ) major=true;; | ||
m ) minor=true;; | ||
p ) patch=true;; | ||
esac | ||
done | ||
|
||
shift $(($OPTIND - 1)) | ||
|
||
version=$1 | ||
|
||
# Build array from version string. | ||
|
||
a=( ${version//./ } ) | ||
|
||
# If version string is missing or has the wrong number of members, show usage message. | ||
|
||
if [ ${#a[@]} -ne 3 ] | ||
then | ||
echo "usage: $(basename $0) [-Mmp] major.minor.patch" | ||
exit 1 | ||
fi | ||
|
||
# Increment version numbers as requested. | ||
|
||
if [ ! -z $major ] | ||
then | ||
((a[0]++)) | ||
a[1]=0 | ||
a[2]=0 | ||
fi | ||
|
||
if [ ! -z $minor ] | ||
then | ||
((a[1]++)) | ||
a[2]=0 | ||
fi | ||
|
||
if [ ! -z $patch ] | ||
then | ||
((a[2]++)) | ||
fi | ||
|
||
echo "${a[0]}.${a[1]}.${a[2]}" |
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/sh | ||
|
||
echo | ||
echo "Last 5 tags:" | ||
git tag --sort=-taggerdate | head -n 5 | ||
echo | ||
|
||
read -p "Enter release version: " VERSION | ||
|
||
if [[ ${VERSION} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | ||
echo "New Version: ${VERSION}" | ||
else | ||
echo "Version must be in the format v0.1.0" | ||
exit 1 | ||
fi | ||
|
||
LOKI_CURRENT=$(sed -n -e 's/^version: //p' production/helm/loki/Chart.yaml) | ||
LOKI_SUGGESTED=$(tools/increment_version.sh -m ${LOKI_CURRENT}) | ||
PROMTAIL_CURRENT=$(sed -n -e 's/^version: //p' production/helm/promtail/Chart.yaml) | ||
PROMTAIL_SUGGESTED=$(tools/increment_version.sh -m ${PROMTAIL_CURRENT}) | ||
LOKI_STACK_CURRENT=$(sed -n -e 's/^version: //p' production/helm/loki-stack/Chart.yaml) | ||
LOKI_STACK_SUGGESTED=$(tools/increment_version.sh -m ${LOKI_STACK_CURRENT}) | ||
echo | ||
echo "Current Loki helm chart version: ${LOKI_CURRENT}" | ||
read -p "Enter new Loki helm chart version [${LOKI_SUGGESTED}]: " LOKI_VERSION | ||
LOKI_VERSION=${LOKI_VERSION:-${LOKI_SUGGESTED}} | ||
echo | ||
echo "Current Promtail helm chart version: ${PROMTAIL_CURRENT}" | ||
read -p "Enter new Promtail helm chart version [${PROMTAIL_SUGGESTED}]: " PROMTAIL_VERSION | ||
PROMTAIL_VERSION=${PROMTAIL_VERSION:-${PROMTAIL_SUGGESTED}} | ||
echo | ||
echo "Current Loki-Stack helm chart version: ${LOKI_STACK_CURRENT}" | ||
read -p "Enter new Loki-Stack helm chart version [${LOKI_STACK_SUGGESTED}]: " LOKI_STACK_VERSION | ||
LOKI_STACK_VERSION=${LOKI_STACK_VERSION:-${LOKI_STACK_SUGGESTED}} | ||
echo | ||
|
||
echo "Creating Release" | ||
echo "Release Version: ${VERSION}" | ||
echo "Loki Helm Chart: ${LOKI_VERSION}" | ||
echo "Promtail Helm Chart: ${PROMTAIL_VERSION}" | ||
echo "Loki-Stack Helm Chart: ${LOKI_STACK_VERSION}" | ||
echo | ||
read -p "Is this correct? [y]: " CONTINUE | ||
CONTINUE=${CONTINUE:-y} | ||
echo | ||
|
||
if [[ "${CONTINUE}" != "y" ]]; then | ||
exit 1 | ||
fi | ||
|
||
echo "Updating helm and ksonnet image versions" | ||
sed -i '' "s/.*promtail:.*/ promtail: '\''grafana\/promtail:${VERSION}'\'',/" production/ksonnet/promtail/config.libsonnet | ||
sed -i '' "s/.*loki:.*/ loki: '\''grafana\/loki:${VERSION}'\'',/" production/ksonnet/loki/images.libsonnet | ||
sed -i '' "s/.*tag:.*/ tag: ${VERSION}/" production/helm/loki/values.yaml | ||
sed -i '' "s/.*tag:.*/ tag: ${VERSION}/" production/helm/promtail/values.yaml | ||
|
||
echo "Updating helm charts" | ||
sed -i '' "s/^version:.*/version: ${LOKI_VERSION}/" production/helm/loki/Chart.yaml | ||
sed -i '' "s/^version:.*/version: ${PROMTAIL_VERSION}/" production/helm/promtail/Chart.yaml | ||
sed -i '' "s/^version:.*/version: ${LOKI_STACK_VERSION}/" production/helm/loki-stack/Chart.yaml | ||
echo | ||
echo "######################################################################################################" | ||
echo "NEXT STEPS" | ||
echo | ||
echo "Verify the changes, then commit and push and get them merged to master" | ||
echo | ||
echo "Once merged to master" | ||
echo | ||
echo "git pull" | ||
echo "git tag -a ${VERSION} -m \"tagging release ${VERSION}\"" | ||
echo "git push origin ${VERSION}" | ||
echo | ||
echo "This should initiate the CircleCI build to push the images and finish the release" | ||
echo "######################################################################################################" | ||
|