Skip to content

Commit 6a6516b

Browse files
Bash script for hotswapping leo jar on fiab (#766)
* starting * still trying * hotswap.sh in automation * changed permissions * cleaned up * comments and error
1 parent 7da53ac commit 6a6516b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

automation/hotswap.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
#Updates the Leo jar of a fiab to reflect current local code.
4+
#Run using "./automation/hotswap.sh fiab-your-fiab-name" from inside the leo directory
5+
6+
if [ -z "$1" ]
7+
then
8+
echo "No arguments supplied. Please provide fiab name as an argument."
9+
exit 1
10+
fi
11+
12+
FIAB=$1
13+
14+
FULL_LEO_JAR=$(sbt assembly | tail -3 | head -2 | grep -o '/Users[^ ]*')
15+
SHORT_LEO_JAR=$(echo ${FULL_LEO_JAR} | grep -oP 'leonardo-assembly[^ ]*')
16+
17+
gcloud compute scp ${FULL_LEO_JAR} ${FIAB}:/tmp --zone=us-central1-a --project broad-dsde-dev
18+
19+
gcloud compute ssh --project broad-dsde-dev --zone us-central1-a ${FIAB} << EOSSH
20+
OLD_JAR=(sudo docker exec -it firecloud_leonardo-app_1 ls /leonardo/)
21+
sudo docker exec -it firecloud_leonardo-app_1 rm /leonardo/\${OLD_JAR}
22+
sudo docker cp /tmp/${SHORT_LEO_JAR} firecloud_leonardo-app_1:/leonardo/
23+
sudo docker restart firecloud_leonardo-app_1
24+
sudo docker restart firecloud_leonardo-proxy_1
25+
EOSSH

0 commit comments

Comments
 (0)