Skip to content

Commit

Permalink
Add test-s
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhuamazon committed Jan 16, 2024
1 parent 4fe6fc8 commit 4524436
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docker/ci/config/gh-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

# This script is to install gh properly on nix* server

set -ex

PLATFORM_LIST=(linux)
for entry in "${PLATFORM_LIST[@]}"; do
if echo $OSTYPE | grep -o $entry; then
PLATFORM=$entry
break
fi
done
ARCH=`uname -m`
VERSION="2.42.0"

echo "$PLATFORM-$ARCH"

case $PLATFORM-$ARCH in
linux-x86_64|linux-amd64)
GH_TYPE="gh_${VERSION}_linux_amd64.tar.gz"
;;
linux-aarch64|linux-arm64)
GH_TYPE="gh_${VERSION}_linux_arm64.tar.gz"
;;
linux-ppc64le)
echo "ppc64le not supported by gh cli, skipping now so docker image creation can proceed"
exit 0
;;
*)
echo "Unsupported combination: $PLATFORM-$ARCH"
exit 1
;;
esac

curl -SL https://github.com/cli/cli/releases/download/v$VERSION/$GH_TYPE -o /tmp/$GH_TYPE
tar -xzf /tmp/$GH_TYPE --strip-component=1 -C /usr
rm -v /tmp/$GH_TYPE
chmod 755 /usr/bin/gh
gh --version

echo "Installed gh $VERSION"

0 comments on commit 4524436

Please sign in to comment.