File tree Expand file tree Collapse file tree 2 files changed +70
-2
lines changed
Expand file tree Collapse file tree 2 files changed +70
-2
lines changed Original file line number Diff line number Diff line change @@ -309,8 +309,8 @@ jobs:
309309 # set up the private key
310310 echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
311311
312- # ssh into the instance and run the set of commands to build
313- ssh -o StrictHostKeyChecking=accept-new -i private_key ubuntu@$public_ip 'cat test.txt; uname -m; export GOROOT=/usr/local/go; export PATH=$GOPATH/bin:$GOROOT/bin:$PATH; go version; cd steampipe-postgres-fdw; git fetch; git checkout $VERSION; rm -rf build-Linux; ./build.sh; exit 0'
312+ # ssh into the instance and run the script to build the binary
313+ ssh -o StrictHostKeyChecking=accept-new -i private_key ubuntu@$public_ip 'bash -s' < script_to_build.sh $VERSION
314314
315315 # use scp to fetch the built binary out of the instance
316316 scp -i private_key ubuntu@$public_ip:/home/ubuntu/steampipe-postgres-fdw/build-Linux/steampipe_postgres_fdw.so .
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # function that makes the script exit, if any command fails
4+ exit_if_failed () {
5+ if [ $? -ne 0 ]
6+ then
7+ exit 1
8+ fi
9+ }
10+
11+ echo " Check arch and export GOROOT & GOPATH"
12+ uname -m
13+ export GOROOT=/usr/local/go
14+ export PATH=$GOPATH /bin:$GOROOT /bin:$PATH
15+ echo " "
16+
17+ echo " Try an existing file"
18+ cat test.txt
19+ exit_if_failed
20+ echo " "
21+
22+ echo " Check go version"
23+ go version
24+ exit_if_failed
25+ echo " "
26+
27+ echo " Checkout to cloned fdw repo"
28+ cd steampipe-postgres-fdw
29+ pwd
30+ echo " "
31+
32+ echo " git reset"
33+ git reset
34+ exit_if_failed
35+ echo " "
36+
37+ echo " git restore all changed files(if any)"
38+ git restore .
39+ exit_if_failed
40+ echo " "
41+
42+ echo " git fetch"
43+ git fetch
44+ exit_if_failed
45+ echo " "
46+
47+ echo " git checkout <tag>"
48+ git checkout $1
49+ exit_if_failed
50+ echo " "
51+
52+ echo " Remove existing build-Linux dir"
53+ rm -rf build-Linux
54+ exit_if_failed
55+ echo " "
56+
57+ echo " Run build script"
58+ ./build_binary.sh
59+ exit_if_failed
60+ echo " "
61+
62+ echo " Check if binary is created"
63+ file build-Linux/steampipe_postgres_fdw.so
64+ exit_if_failed
65+ echo " "
66+
67+ echo " Hallelujah!"
68+ exit 0
You can’t perform that action at this time.
0 commit comments