parent
b64780811b
commit
885e0f0662
1 changed files with 53 additions and 54 deletions
55
cd.sh
55
cd.sh
|
@ -7,10 +7,9 @@ CD_NAME='cd'
|
|||
CD_REPOSITORIES_PARENT='rwx'
|
||||
|
||||
function cd_set_environment {
|
||||
#
|
||||
CD_DNS_FILE='/etc/resolv.conf'
|
||||
CD_ENV="$(mktemp)"
|
||||
case "${CD_OS_NAME}" in
|
||||
case "${CD_OS_NAME}" in
|
||||
'debian')
|
||||
CD_PYTHON_COMMAND='python3'
|
||||
CD_PYTHON_PACKAGES='/usr/lib/python3/dist-packages'
|
||||
|
@ -28,41 +27,41 @@ case "${CD_OS_NAME}" in
|
|||
echo 'CD_OS_NAME'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
# project / branch
|
||||
[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||
[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||
if [ ! "${CD_PROJECT_BRANCH}" ] ; then
|
||||
esac
|
||||
# project / branch
|
||||
[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||
[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||
if [ ! "${CD_PROJECT_BRANCH}" ] ; then
|
||||
echo 'CD_PROJECT_BRANCH'
|
||||
exit 3
|
||||
fi
|
||||
# project / name
|
||||
[ "${CI_PROJECT_PATH}" ] \
|
||||
&& CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||
[ "${GITHUB_REPOSITORY}" ] \
|
||||
&& CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||
if [ ! "${CD_PROJECT_NAME}" ] ; then
|
||||
fi
|
||||
# project / name
|
||||
[ "${CI_PROJECT_PATH}" ] \
|
||||
&& CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||
[ "${GITHUB_REPOSITORY}" ] \
|
||||
&& CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||
if [ ! "${CD_PROJECT_NAME}" ] ; then
|
||||
echo 'CD_PROJECT_NAME'
|
||||
exit 3
|
||||
fi
|
||||
# projects / group
|
||||
[ "${CI_PROJECT_PATH}" ] \
|
||||
&& CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||
[ "${GITHUB_REPOSITORY}" ] \
|
||||
&& CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||
if [ ! "${CD_PROJECTS_GROUP}" ] ; then
|
||||
fi
|
||||
# projects / group
|
||||
[ "${CI_PROJECT_PATH}" ] \
|
||||
&& CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||
[ "${GITHUB_REPOSITORY}" ] \
|
||||
&& CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||
if [ ! "${CD_PROJECTS_GROUP}" ] ; then
|
||||
echo 'CD_PROJECTS_GROUP'
|
||||
exit 3
|
||||
fi
|
||||
# projects / url
|
||||
[ "${CI_SERVER_URL}" ] && CD_PROJECTS_URL="${CI_SERVER_URL}"
|
||||
[ "${GITHUB_SERVER_URL}" ] && CD_PROJECTS_URL="${GITHUB_SERVER_URL}"
|
||||
if [ "${CD_PROJECTS_URL}" ] ; then
|
||||
fi
|
||||
# projects / url
|
||||
[ "${CI_SERVER_URL}" ] && CD_PROJECTS_URL="${CI_SERVER_URL}"
|
||||
[ "${GITHUB_SERVER_URL}" ] && CD_PROJECTS_URL="${GITHUB_SERVER_URL}"
|
||||
if [ "${CD_PROJECTS_URL}" ] ; then
|
||||
CD_PROJECTS_URL+="/${CD_PROJECTS_GROUP}"
|
||||
else
|
||||
else
|
||||
echo 'CD_PROJECTS_URL'
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
# project / url
|
||||
CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue