Skip to content

Commit

Permalink
Change the when CLI installation procedure (#466)
Browse files Browse the repository at this point in the history
* Change the when CLI instalation procedure

* fix: Remove trailing new line in ERLANG_VERSION env var
  • Loading branch information
DamjanBecirovic authored Dec 23, 2024
1 parent 6cf817c commit cebbdfc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
3 changes: 2 additions & 1 deletion install-self-hosted-toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ fi


echo "Installing the when CLI"
install_cmd mv ~/.toolbox/when $INSTALL_PATH/when
ERLANG_VERSION=$(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell | tr -d '"\r')
install_cmd mv ~/.toolbox/when_otp_$ERLANG_VERSION $INSTALL_PATH/when
install_cmd chmod +x $INSTALL_PATH/when
if [[ $? -eq 0 ]];then
echo "when installed"
Expand Down
4 changes: 2 additions & 2 deletions install-toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ if [[ `uname` != "Darwin" ]]; then
echo "toolbox_install_error_spc" >> /tmp/toolbox_metrics
fi


echo "Installing the when CLI"
install_cmd mv ~/.toolbox/when $INSTALL_PATH/when
ERLANG_VERSION=$(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell | tr -d '"\r')
install_cmd mv ~/.toolbox/when_otp_$ERLANG_VERSION $INSTALL_PATH/when
install_cmd chmod +x $INSTALL_PATH/when
if [[ $? -eq 0 ]];then
echo "when installed"
Expand Down
41 changes: 31 additions & 10 deletions release/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
set -euo pipefail

ARTIFACT_CLI_VERSION="v0.6.5"
WHEN_CLI_VERSION="v1.0.5"
SPC_CLI_VERSION="v1.12.1"
TEST_RESULTS_CLI_VERSION="v0.7.0"
WHEN_CLI_VERSION="v1.2.1"
# we include multiple when binaries for all suported Erlang versions
# and configure the correct one based on Erlang version in the VM where toolbox is installed
WHEN_BINARY_VERSION_1="when_otp_24"
WHEN_BINARY_VERSION_2="when_otp_25"
WHEN_BINARY_VERSION_3="when_otp_26"

ARTIFACT_CLI_URL="https://github.com/semaphoreci/artifact/releases/download/$ARTIFACT_CLI_VERSION"
SPC_CLI_URL="https://github.com/semaphoreci/spc/releases/download/$SPC_CLI_VERSION"
Expand All @@ -15,9 +20,18 @@ WHEN_CLI_URL="https://github.com/renderedtext/when/releases/download/$WHEN_CLI_V
download_when_cli() {
rm -rf /tmp/when-cli
mkdir -p /tmp/when-cli
echo "Downloading when CLI..."
curl -sL --retry 5 $WHEN_CLI_URL/when -o /tmp/when-cli/when
chmod +x /tmp/when-cli/when

echo "Downloading when CLI binary $WHEN_BINARY_VERSION_1"
curl -sL --retry 5 $WHEN_CLI_URL/$WHEN_BINARY_VERSION_1 -o /tmp/when-cli/$WHEN_BINARY_VERSION_1
chmod +x /tmp/when-cli/$WHEN_BINARY_VERSION_1

echo "Downloading when CLI binary $WHEN_BINARY_VERSION_2"
curl -sL --retry 5 $WHEN_CLI_URL/$WHEN_BINARY_VERSION_2 -o /tmp/when-cli/$WHEN_BINARY_VERSION_2
chmod +x /tmp/when-cli/$WHEN_BINARY_VERSION_2

echo "Downloading when CLI binary $WHEN_BINARY_VERSION_3"
curl -sL --retry 5 $WHEN_CLI_URL/$WHEN_BINARY_VERSION_3 -o /tmp/when-cli/$WHEN_BINARY_VERSION_3
chmod +x /tmp/when-cli/$WHEN_BINARY_VERSION_3
}

create_tarball() {
Expand Down Expand Up @@ -176,10 +190,13 @@ self_hosted::pack() {
include_external_darwin_binary $SPC_CLI_URL "spc" /tmp/self-hosted-Darwin "x86_64"
include_external_darwin_binary $SPC_CLI_URL "spc" /tmp/self-hosted-Darwin-arm "arm64"

cp /tmp/when-cli/when /tmp/self-hosted-Linux/toolbox/when
cp /tmp/when-cli/when /tmp/self-hosted-Linux-arm/toolbox/when
cp /tmp/when-cli/when /tmp/self-hosted-Darwin/toolbox/when
cp /tmp/when-cli/when /tmp/self-hosted-Darwin-arm/toolbox/when
cp /tmp/when-cli/$WHEN_BINARY_VERSION_1 /tmp/self-hosted-Linux/toolbox/$WHEN_BINARY_VERSION_1
cp /tmp/when-cli/$WHEN_BINARY_VERSION_2 /tmp/self-hosted-Linux/toolbox/$WHEN_BINARY_VERSION_2
cp /tmp/when-cli/$WHEN_BINARY_VERSION_3 /tmp/self-hosted-Linux/toolbox/$WHEN_BINARY_VERSION_3

cp /tmp/when-cli/$WHEN_BINARY_VERSION_1 /tmp/self-hosted-Linux-arm/toolbox/$WHEN_BINARY_VERSION_1
cp /tmp/when-cli/$WHEN_BINARY_VERSION_2 /tmp/self-hosted-Linux-arm/toolbox/$WHEN_BINARY_VERSION_2
cp /tmp/when-cli/$WHEN_BINARY_VERSION_3 /tmp/self-hosted-Linux-arm/toolbox/$WHEN_BINARY_VERSION_3

cp ~/$SEMAPHORE_GIT_DIR/cache-cli/bin/linux/amd64/cache /tmp/self-hosted-Linux/toolbox/
cp ~/$SEMAPHORE_GIT_DIR/cache-cli/bin/linux/arm64/cache /tmp/self-hosted-Linux-arm/toolbox/
Expand Down Expand Up @@ -212,8 +229,12 @@ hosted::pack() {
cp ~/$SEMAPHORE_GIT_DIR/sem-context/bin/linux/arm64/sem-context /tmp/Linux-arm/toolbox/sem-context
cp ~/$SEMAPHORE_GIT_DIR/sem-context/bin/darwin/amd64/sem-context /tmp/Darwin/toolbox/sem-context
cp ~/$SEMAPHORE_GIT_DIR/sem-context/bin/darwin/arm64/sem-context /tmp/Darwin-arm/toolbox/sem-context
cp /tmp/when-cli/when /tmp/Linux/toolbox/when
cp /tmp/when-cli/when /tmp/Linux-arm/toolbox/when
cp /tmp/when-cli/$WHEN_BINARY_VERSION_1 /tmp/Linux/toolbox/$WHEN_BINARY_VERSION_1
cp /tmp/when-cli/$WHEN_BINARY_VERSION_2 /tmp/Linux/toolbox/$WHEN_BINARY_VERSION_2
cp /tmp/when-cli/$WHEN_BINARY_VERSION_3 /tmp/Linux/toolbox/$WHEN_BINARY_VERSION_3
cp /tmp/when-cli/$WHEN_BINARY_VERSION_1 /tmp/Linux-arm/toolbox/$WHEN_BINARY_VERSION_1
cp /tmp/when-cli/$WHEN_BINARY_VERSION_2 /tmp/Linux-arm/toolbox/$WHEN_BINARY_VERSION_2
cp /tmp/when-cli/$WHEN_BINARY_VERSION_3 /tmp/Linux-arm/toolbox/$WHEN_BINARY_VERSION_3
}

create_self_hosted=false
Expand Down

0 comments on commit cebbdfc

Please sign in to comment.