-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate
More file actions
executable file
·20 lines (18 loc) · 765 Bytes
/
Copy pathcreate
File metadata and controls
executable file
·20 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
set -euo pipefail
cd ~/code/build-instance
terraform apply -auto-approve -var region=us-east-2 -var myip=$(curl ifconfig.me)
PUBLIC_IP="$(terraform output -raw public_ipv4_address)"
tmp_file="$(mktemp)"
awk -v ipaddr=$PUBLIC_IP '/^Host builder$/ {f=1; print; next} f {$2=ipaddr; f=0; print " "$0; next} 1' ~/.ssh/config > "${tmp_file}"
mv -f "${tmp_file}" ~/.ssh/config
chmod 0400 ~/.ssh/config
echo "Waiting for builder instance to be ready"
while ! ssh builder test -d hypershift.git 2> /dev/null; do
sleep 5
done
echo "Copying files to builder instance..."
scp ./post-receive builder:hypershift.git/hooks/post-receive
ssh builder chmod +x hypershift.git/hooks/post-receive
scp ./pull-secret builder:.pull-secret
echo "Builder instance is ready"