splited delivery scripts

production
Override-6 2 years ago
parent 0b804fc7fb
commit 7c8e46d70b

@ -1,40 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "installing packages..." ./drone/prepare-delivery.sh
yum update > /dev/null
yum -y install openssh-clients openssh-client > /dev/null
echo "done."
rm -rf /root/.ssh
mkdir -p /root/.ssh
echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub
chmod 0600 /root/.ssh/*
chmod 700 /root/.ssh
ls -lsh /root/.ssh
ls -ld /root/.ssh
pwd
case "$1" in
"dev")
USER=maxime
IP=92.132.18.192
DIR=server/TBasket/backend
;;
"production")
USER=palafour
IP=193.49.118.205
DIR=TBasket/backend
;;
"")
echo "first argument is missing" >&2
exit 1
;;
*)
echo "branch $1 is unable to perform delivery, authorized branches are 'dev and production' for delivery." >&2
echo "delivery step skipped"
exit 0
esac
./gradlew :shadowJar ./gradlew :shadowJar

@ -0,0 +1,35 @@
#!/usr/bin/env bash
#use the right command to install packages
if [ "$(command -v apt)" ]; then CMD=apt; else CMD=yum; fi
echo "installing packages..."
eval $CMD update > /dev/null
eval $CMD -y install openssh-client > /dev/null
echo "done."
echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub
chmod 0600 /root/.ssh/*
chmod 700 /root/.ssh
case "$1" in
"dev")
export USER=maxime
export IP=92.132.18.192
export DIR=server/TBasket/backend
;;
"production")
export USER=palafour
export IP=193.49.118.205
export DIR=TBasket/backend
;;
"")
echo "first argument is missing" >&2
exit 1
;;
*)
echo "branch $1 is unable to perform delivery, authorized branches are 'dev and production' for delivery." >&2
echo "delivery step skipped"
exit 0
esac