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'
|
CD_REPOSITORIES_PARENT='rwx'
|
||||||
|
|
||||||
function cd_set_environment {
|
function cd_set_environment {
|
||||||
#
|
|
||||||
CD_DNS_FILE='/etc/resolv.conf'
|
CD_DNS_FILE='/etc/resolv.conf'
|
||||||
CD_ENV="$(mktemp)"
|
CD_ENV="$(mktemp)"
|
||||||
case "${CD_OS_NAME}" in
|
case "${CD_OS_NAME}" in
|
||||||
'debian')
|
'debian')
|
||||||
CD_PYTHON_COMMAND='python3'
|
CD_PYTHON_COMMAND='python3'
|
||||||
CD_PYTHON_PACKAGES='/usr/lib/python3/dist-packages'
|
CD_PYTHON_PACKAGES='/usr/lib/python3/dist-packages'
|
||||||
|
@ -28,41 +27,41 @@ case "${CD_OS_NAME}" in
|
||||||
echo 'CD_OS_NAME'
|
echo 'CD_OS_NAME'
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# project / branch
|
# project / branch
|
||||||
[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||||
[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||||
if [ ! "${CD_PROJECT_BRANCH}" ] ; then
|
if [ ! "${CD_PROJECT_BRANCH}" ] ; then
|
||||||
echo 'CD_PROJECT_BRANCH'
|
echo 'CD_PROJECT_BRANCH'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
# project / name
|
# project / name
|
||||||
[ "${CI_PROJECT_PATH}" ] \
|
[ "${CI_PROJECT_PATH}" ] \
|
||||||
&& CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
&& CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||||
[ "${GITHUB_REPOSITORY}" ] \
|
[ "${GITHUB_REPOSITORY}" ] \
|
||||||
&& CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
&& CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||||
if [ ! "${CD_PROJECT_NAME}" ] ; then
|
if [ ! "${CD_PROJECT_NAME}" ] ; then
|
||||||
echo 'CD_PROJECT_NAME'
|
echo 'CD_PROJECT_NAME'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
# projects / group
|
# projects / group
|
||||||
[ "${CI_PROJECT_PATH}" ] \
|
[ "${CI_PROJECT_PATH}" ] \
|
||||||
&& CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
&& CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||||
[ "${GITHUB_REPOSITORY}" ] \
|
[ "${GITHUB_REPOSITORY}" ] \
|
||||||
&& CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
&& CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||||
if [ ! "${CD_PROJECTS_GROUP}" ] ; then
|
if [ ! "${CD_PROJECTS_GROUP}" ] ; then
|
||||||
echo 'CD_PROJECTS_GROUP'
|
echo 'CD_PROJECTS_GROUP'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
# projects / url
|
# projects / url
|
||||||
[ "${CI_SERVER_URL}" ] && CD_PROJECTS_URL="${CI_SERVER_URL}"
|
[ "${CI_SERVER_URL}" ] && CD_PROJECTS_URL="${CI_SERVER_URL}"
|
||||||
[ "${GITHUB_SERVER_URL}" ] && CD_PROJECTS_URL="${GITHUB_SERVER_URL}"
|
[ "${GITHUB_SERVER_URL}" ] && CD_PROJECTS_URL="${GITHUB_SERVER_URL}"
|
||||||
if [ "${CD_PROJECTS_URL}" ] ; then
|
if [ "${CD_PROJECTS_URL}" ] ; then
|
||||||
CD_PROJECTS_URL+="/${CD_PROJECTS_GROUP}"
|
CD_PROJECTS_URL+="/${CD_PROJECTS_GROUP}"
|
||||||
else
|
else
|
||||||
echo 'CD_PROJECTS_URL'
|
echo 'CD_PROJECTS_URL'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
# project / url
|
# project / url
|
||||||
CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}"
|
CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue