Skip to content

Commit

Permalink
Update linux-build.sh to be useful with continuous builds.
Browse files Browse the repository at this point in the history
JIRA Issues: PFD-244

Differential Revision: https://phabricator.twitter.biz/D926038
  • Loading branch information
dbernadett authored and CI committed Jul 7, 2022
1 parent e13d253 commit aa8ae7d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions scripts/linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function die() {
}

role=${1-"the-focus-indexer"}
skip_mark_live=${2-"false"}

##
## Preconditions
Expand All @@ -25,12 +26,8 @@ packer fetch --use-tfe --cluster=smf1 io-perf rust-dev live
tar xzf rust-dev.tgz
popd


cargo_target=x86_64-unknown-linux-gnu
export PATH="${PATH}:${PWD}/toolchain/rust-dev/bin"
rm -rf focus
git clone --single-branch -b main --depth 1 http://git.twitter.biz/ro/focus
pushd focus
# get proxy credentials from TSS
echo "Getting proxy credentials..."
export HTTP_PROXY="http://rust-crates:$(cat /var/lib/tss/keys/io-perf/rust-crates/proxy-pass)@httpproxy.local.twitter.com:3128"
Expand All @@ -49,7 +46,6 @@ cargo --version
# build
echo "Building..."
cargo build --release --target "$cargo_target"
popd

##
## Upload to Packer
Expand All @@ -59,7 +55,7 @@ test -d release && rm -r release
mkdir release
pushd release
mkdir bin
cp ../focus/target/$cargo_target/release/focus bin/focus
cp ../target/$cargo_target/release/focus bin/focus
tar jcf ../focus.tar.bz2 .
clusters=("smf1" "atla" "pdxa")
for cluster in ${clusters[@]}; do
Expand All @@ -71,10 +67,12 @@ popd
##
## Mark latest packer versions live
##
package="focus.Linux.x86_64"
clusters=("smf1" "atla" "pdxa")
for cluster in ${clusters[@]}; do
version=$(packer versions "--cluster=$cluster" --use-tfe "$role" "$package" 2>&1 | grep 'Version' | awk '{print $2}' | tail -n1)
echo "Latest version in $cluster is $version; marking it as LIVE"
packer set_live "--cluster=$cluster" "$role" "$package" "$version"
done
if [[ "$skip_mark_live" == "false" ]]; then
package="focus.Linux.x86_64"
clusters=("smf1" "atla" "pdxa")
for cluster in ${clusters[@]}; do
version=$(packer versions "--cluster=$cluster" --use-tfe "$role" "$package" 2>&1 | grep 'Version' | awk '{print $2}' | tail -n1)
echo "Latest version in $cluster is $version; marking it as LIVE"
packer set_live "--cluster=$cluster" "$role" "$package" "$version"
done
fi

0 comments on commit aa8ae7d

Please sign in to comment.