merge in @royrico pull request into 7.1 code

This commit is contained in:
Ric Harvey
2017-02-07 10:36:43 +00:00
parent cfcf9f7fbc
commit 2ec8a51070
2 changed files with 13 additions and 11 deletions

View File

@@ -48,6 +48,7 @@ The following flags are a list of all the currently supported options that can b
- **GIT_BRANCH** : Select a specific branch (optional)
- **GIT_EMAIL** : Set your email for code pushing (required for git to work)
- **GIT_NAME** : Set your name for code pushing (required for git to work)
- **GIT_USE_SSH** : Set this to 1 if you want to use git over SSH (instead of HTTP), useful if you want to use Bitbucket instead of GitHub
- **SSH_KEY** : Private SSH deploy key for your repository base64 encoded (requires write permissions for pushing)
- **GIT_PERSONAL_TOKEN** : Personal access token for your git account (required for HTTPS git access)
- **GIT_USERNAME** : Git username for use with personal tokens. (required for HTTPS git access)

View File

@@ -34,19 +34,20 @@ if [ ! -d "/var/www/html/.git" ]; then
if [ ! -z "$GIT_REPO" ]; then
# Remove the test index file
rm -Rf /var/www/html/*
GIT_COMMAND='git clone '
if [ ! -z "$GIT_BRANCH" ]; then
GIT_COMMAND=${GIT_COMMAND}" -b ${GIT_BRANCH}"
fi
if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then
git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ || exit 1
GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}"
else
git clone -b ${GIT_BRANCH} https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO} /var/www/html || exit 1
fi
if [[ "$GIT_USE_SSH" == "1" ]]; then
GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}"
else
if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then
git clone $GIT_REPO /var/www/html/ || exit 1
else
git clone https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO} /var/www/html || exit 1
fi
GIT_COMMAND=${GIT_COMMAND}" https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO}"
fi
${GIT_COMMAND} /var/www/html || exit 1
chown -Rf nginx.nginx /var/www/html
fi
fi