Compare commits
No commits in common. "afffb8c90f3be83fb8d89be8ad103b83e06ce436" and "0fc4690cd1d51e26b2fc36175043e5a58d5543d8" have entirely different histories.
afffb8c90f
...
0fc4690cd1
3 changed files with 2 additions and 34 deletions
18
cd.sh
18
cd.sh
|
@ -27,7 +27,6 @@ case "${CD_OS_NAME}" in
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
|
||||||
[ "${CI_SERVER_URL}" ] && CD_REPOSITORIES_URL="${CI_SERVER_URL}"
|
[ "${CI_SERVER_URL}" ] && CD_REPOSITORIES_URL="${CI_SERVER_URL}"
|
||||||
[ "${GITHUB_SERVER_URL}" ] && CD_REPOSITORIES_URL="${GITHUB_SERVER_URL}"
|
[ "${GITHUB_SERVER_URL}" ] && CD_REPOSITORIES_URL="${GITHUB_SERVER_URL}"
|
||||||
if [ "${CD_REPOSITORIES_URL}" ] ; then
|
if [ "${CD_REPOSITORIES_URL}" ] ; then
|
||||||
|
@ -36,23 +35,6 @@ else
|
||||||
echo 'CD_REPOSITORIES_URL'
|
echo 'CD_REPOSITORIES_URL'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
#
|
|
||||||
[ "${CI_PROJECT_NAME}" ] && CD_PROJECT_NAME="${CI_PROJECT_NAME}"
|
|
||||||
[ "${GITHUB_REPOSITORY}" ] \
|
|
||||||
&& CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
|
||||||
if [ "${CD_PROJECT_NAME}" ] ; then
|
|
||||||
CD_PROJECT_URL="${CD_REPOSITORIES_URL}/${CD_PROJECT_NAME}"
|
|
||||||
else
|
|
||||||
echo 'CD_PROJECT_NAME'
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
[ "${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
|
|
||||||
|
|
||||||
function cd_step {
|
function cd_step {
|
||||||
if [ "${1}" ] ; then
|
if [ "${1}" ] ; then
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from rwx import ps
|
|
||||||
|
|
||||||
COMMANDS_PREFIX = 'cd-'
|
COMMANDS_PREFIX = 'cd-'
|
||||||
|
|
||||||
|
|
||||||
def cd_clone_branch():
|
|
||||||
ps.run('git',
|
|
||||||
'clone',
|
|
||||||
'--branch', os.environ['CD_PROJECT_BRANCH'],
|
|
||||||
'--',
|
|
||||||
os.environ['CD_PROJECT_URL'],
|
|
||||||
'.',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def cd_list_environment():
|
def cd_list_environment():
|
||||||
for variable, value in sorted(os.environ.items()):
|
for variable, value in sorted(os.environ.items()):
|
||||||
print(variable, '=', value)
|
print(variable, '=', value)
|
||||||
|
@ -22,8 +10,5 @@ def cd_list_environment():
|
||||||
|
|
||||||
def install_commands(path):
|
def install_commands(path):
|
||||||
user = '/usr/local/bin'
|
user = '/usr/local/bin'
|
||||||
for command in [
|
for command in ['list-environment']:
|
||||||
'clone-branch',
|
|
||||||
'list-environment',
|
|
||||||
]:
|
|
||||||
os.symlink(path, os.path.join(user, f'{COMMANDS_PREFIX}{command}'))
|
os.symlink(path, os.path.join(user, f'{COMMANDS_PREFIX}{command}'))
|
||||||
|
|
1
cmd/cd-list-environment.sh
Executable file
1
cmd/cd-list-environment.sh
Executable file
|
@ -0,0 +1 @@
|
||||||
|
env | sort
|
Loading…
Reference in a new issue