Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ronaldmiranda/d6a9fd27bf78db2be3f43fbad168378f to your computer and use it in GitHub Desktop.
Save ronaldmiranda/d6a9fd27bf78db2be3f43fbad168378f to your computer and use it in GitHub Desktop.
#!/bin/bash
STABLE_GIT_COMMIT_SUFFIX=$([[ -n "$(git status --porcelain)" ]] && echo '-dirty')
echo "STABLE_GIT_COMMIT $(git rev-parse --short HEAD)"
echo "STABLE_GIT_COMMIT_SUFFIX $STABLE_GIT_COMMIT_SUFFIX"
echo "STABLE_GIT_DATE $(TZ=UTC git show --quiet --date='format-local:%Y-%m-%dT%H:%M:%SZ' --format="%cd")"
echo "STABLE_K8S_VERSION $(git log -n 1 --pretty='format:%cd' --date=format:'%Y.%m.%d.%H%M')$STABLE_GIT_COMMIT_SUFFIX"
echo "STABLE_DOCKER_TAG $(git log -n 1 --pretty='format:%cd-%h' --date=format:'%Y%m%d%H%M')$STABLE_GIT_COMMIT_SUFFIX"
echo "STABLE_VERSION_LABEL $(date '+%y.%m.%d.%H%M')$STABLE_GIT_COMMIT_SUFFIX"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment