Skip to content

Commit

Permalink
Add proper handling of VERSION. Add BUILD
Browse files Browse the repository at this point in the history
  • Loading branch information
tlex committed Oct 8, 2020
1 parent a3e5c06 commit b95cf89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env sh

echo "Setting VERSION='${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}' in grafana-email/constants.py"
echo "VERSION = '${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}'" >> grafana-email/constants.py
echo "Setting VERSION"
find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i "s/^VERSION.*/VERSION\ =\ \'${CI_COMMIT_REF_NAME:-None}\'/g" {} + -exec grep VERSION {} +
echo "Setting BUILD"
find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i "s/^BUILD.*/BUILD\ =\ \'${CI_PIPELINE_ID:-None}\'/g" {} + -exec grep BUILD {} +
1 change: 1 addition & 0 deletions grafana-email/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
""" Constants declarations """

VERSION = None
BUILD = None
2 changes: 1 addition & 1 deletion grafana-email/grafana-email.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def send_email(self):
if __name__ == '__main__':
configure_logging()
# pylint: disable=no-member
LOG.info(f"Starting {FILENAME} {constants.VERSION}")
LOG.info(f"Starting {FILENAME} {constants.VERSION}-{constants.BUILD}")
grafana = GrafanaEmail()
grafana.get_panels()
grafana.send_email()

0 comments on commit b95cf89

Please sign in to comment.