Skip to content

Commit

Permalink
nicely format install sh
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead committed Nov 2, 2023
1 parent 950e02f commit 632925e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/e2e-test-tf-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
shell: bash
run: |
run_id=${{ github.run_id }}
last_three=${run_id: -3}
last_three="${run_id: -3}"
echo "prefix=e2e-${last_three}-${{ github.run_attempt }}" | tee -a $GITHUB_OUTPUT
- name: Create Terraform variable input file
Expand Down Expand Up @@ -166,7 +166,6 @@ jobs:
mkdir build
curl -fsSL -o constellation https://github.com/edgelesssys/constellation/releases/download/${{ inputs.cliVersion }}/constellation-linux-amd64
chmod u+x constellation
echo "$(pwd)" >> $GITHUB_PATH
export PATH="$PATH:$(pwd)"
constellation version
# Do not spam license server from pipeline
Expand Down
38 changes: 19 additions & 19 deletions terraform/aws-constellation/install-yq.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#!/usr/bin/env bash
VERSION="v4.35.2"
if [ -f ./yq ] && echo $(./yq --version) | grep -q "$VERSION"; then
echo "yq is already installed and up to date."
if [ -f ./yq ] && ./yq --version | grep -q "${VERSION}"; then
echo "yq is already available and up to date."
exit 0
fi
if [ -f ./yq ]; then
echo "yq is already installed but not at the required version. Replacing with $VERSION."
echo "yq is already available but not at the required version. Replacing with ${VERSION}."
rm -f yq
fi

echo "Installing yq $VERSION"
echo "Fetching yq ${VERSION}"
OS=$(uname -s)
ARCH=$(uname -m)
URL=""

if [ "$OS" == "Darwin" ]; then
if [ "$ARCH" == "arm64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/$VERSION/yq_darwin_arm64"
elif [ "$ARCH" == "x86_64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/$VERSION/yq_darwin_amd64"
if [ "${OS}" == "Darwin" ]; then
if [ "${ARCH}" == "arm64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_darwin_arm64"
elif [ "${ARCH}" == "x86_64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_darwin_amd64"
fi
elif [ "$OS" == "Linux" ]; then
if [ "$ARCH" == "x86_64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/$VERSION/yq_linux_amd64"
elif [ "$ARCH" == "arm64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/$VERSION/yq_linux_arm64"
elif [ "${OS}" == "Linux" ]; then
if [ "${ARCH}" == "x86_64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_amd64"
elif [ "${ARCH}" == "arm64" ]; then
URL="https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_arm64"
fi
fi

if [ -z "$URL" ]; then
echo "OS \"$OS\" and/or architecture \"$ARCH\" is not supported."
if [ -z "${URL}" ]; then
echo "OS \"${OS}\" and/or architecture \"${ARCH}\" is not supported."
exit 1
else
echo "Downloading yq from $URL"
curl -o yq -L $URL
echo "Downloading yq from ${URL}"
curl -o yq -L "${URL}"
chmod +x ./yq
./yq --version
if ! echo $(./yq --version) | grep -q "$VERSION"; then # check that yq was installed correctly
if ! ./yq --version | grep -q "${VERSION}"; then # check that yq was installed correctly
echo "Version is incorrect"
exit 1
fi
Expand Down
52 changes: 28 additions & 24 deletions terraform/constellation-cluster/install-constellation.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
#!/usr/bin/env bash
if ! [ -f ./constellation ]; then
OS=$(uname -s)
ARCH=$(uname -m)
VERSION="latest"
URL=""
if [ -f ./constellation ]; then
echo "constellation CLI is already available."
exit 0
fi

if [ $OS == "Darwin" ]; then
if [ $ARCH == "arm64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-darwin-arm64"
elif [ $ARCH == "x86_64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-darwin-amd64"
fi
elif [ $OS == "Linux" ]; then
if [ $ARCH == "x86_64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-linux-amd64"
elif [ $ARCH == "arm64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-linux-arm64"
fi
fi
echo "Fetching constellation ${VERSION}"
OS=$(uname -s)
ARCH=$(uname -m)
VERSION="latest"
URL=""

if [ -z "$URL" ]; then
echo "OS \"$OS\" and/or architecture \"$ARCH\" is not supported."
exit 1
else
curl -o constellation -L $URL
chmod +x constellation
if [ "${OS}" == "Darwin" ]; then
if [ "${ARCH}" == "arm64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-darwin-arm64"
elif [ "${ARCH}" == "x86_64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-darwin-amd64"
fi
elif [ "${OS}" == "Linux" ]; then
if [ "${ARCH}" == "x86_64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-linux-amd64"
elif [ "${ARCH}" == "arm64" ]; then
URL="https://github.com/edgelesssys/constellation/releases/${VERSION}/download/constellation-linux-arm64"
fi
fi

if [ -z "${URL}" ]; then
echo "OS \"${OS}\" and/or architecture \"${ARCH}\" is not supported."
exit 1
else
curl -o constellation -L "${URL}"
chmod +x constellation
fi

0 comments on commit 632925e

Please sign in to comment.