Created
August 10, 2018 17:12
-
-
Save sshastri/61b510b0c261d266e6e32eb7576f5abf to your computer and use it in GitHub Desktop.
environment.conf script
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
#! /bin/sh | |
if (( $# != 1 )); then | |
echo "Call this script with the name of the environment" | |
echo "Example: ${0} production" | |
exit 1 | |
fi | |
CODEDIR='/etc/puppetlabs/code/environments' | |
CODESTAGE='/etc/puppetlabs/code-staging/environments' | |
GITCODEDIR="${CODEDIR}/${1}/.git" | |
GITCODESTAGE="${CODESTAGE}/${1}/.git" | |
# Are we using old-school git clones? | |
if [ -d ${GITCODEDIR} ]; then | |
git --git-dir ${GITCODEDIR} rev-parse --short HEAD | |
elif [ -d ${GITCODESTAGE} ]; then | |
git --git-dir ${GITCODESTAGE} rev-parse --short HEAD | |
else | |
date '+%s' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment