From d7dc4dda8bdae129912101614bef66612445eade Mon Sep 17 00:00:00 2001 From: Aditya Sadalage Date: Thu, 27 Oct 2022 15:42:34 -0700 Subject: [PATCH 1/5] Added if condition to check arch --- contrib/gh-runner/gh-runner.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/gh-runner/gh-runner.sh b/contrib/gh-runner/gh-runner.sh index 98f5f73438c..f35da9cffa1 100644 --- a/contrib/gh-runner/gh-runner.sh +++ b/contrib/gh-runner/gh-runner.sh @@ -22,6 +22,13 @@ sudo usermod -aG docker ${USER} newgrp docker & # Install & Setup GH Actions Runner mkdir actions-runner && cd actions-runner +if [ "$(uname -m)" = "aarch64" ]; then + echo "Detected arm64 architecture" +elif [ "$(uname -m)" = "x86_64" ]; then + echo "Detected amd64 architecture" +else + echo "Unrecognized architecture" +fi curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz echo "34a8f34956cdacd2156d4c658cce8dd54c5aef316a16bbbc95eb3ca4fd76429a actions-runner-linux-x64-2.296.2.tar.gz" | shasum -a 256 -c tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz From fc66559610870657179cb7c3ee5245dad96fc0c0 Mon Sep 17 00:00:00 2001 From: Aditya Sadalage Date: Thu, 27 Oct 2022 18:04:24 -0700 Subject: [PATCH 2/5] Added installs based on if condition --- contrib/gh-runner/gh-runner.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/contrib/gh-runner/gh-runner.sh b/contrib/gh-runner/gh-runner.sh index f35da9cffa1..736cccbc74d 100644 --- a/contrib/gh-runner/gh-runner.sh +++ b/contrib/gh-runner/gh-runner.sh @@ -24,14 +24,33 @@ newgrp docker & mkdir actions-runner && cd actions-runner if [ "$(uname -m)" = "aarch64" ]; then echo "Detected arm64 architecture" + + # Download the latest runner package + curl -o actions-runner-linux-arm64-2.298.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.298.2/actions-runner-linux-arm64-2.298.2.tar.gz + + # Optional: Validate the hash + echo "803e4aba36484ef4f126df184220946bc151ae1bbaf2b606b6e2f2280f5042e8 actions-runner-linux-arm64-2.298.2.tar.gz" | shasum -a 256 -c + + # Extract the installer + tar xzf ./actions-runner-linux-arm64-2.298.2.tar.gz + elif [ "$(uname -m)" = "x86_64" ]; then echo "Detected amd64 architecture" + + # Download the latest runner package + curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz + + # Optional: Validate the hash + echo "34a8f34956cdacd2156d4c658cce8dd54c5aef316a16bbbc95eb3ca4fd76429a actions-runner-linux-x64-2.296.2.tar.gz" | shasum -a 256 -c + + # Extract the installer + tar xzf ./actions-runner-linux-x64-2.298.2.tar.gz + else echo "Unrecognized architecture" fi -curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz -echo "34a8f34956cdacd2156d4c658cce8dd54c5aef316a16bbbc95eb3ca4fd76429a actions-runner-linux-x64-2.296.2.tar.gz" | shasum -a 256 -c -tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz + +# Create the runner and start the configuration experience ./config.sh --url https://github.com/dgraph-io/dgraph --token $TOKEN # CI Permission Issue sudo touch /etc/cron.d/ci_permissions_resetter From 5d04f4622b8c9170c95f8217278a6e8b5a401287 Mon Sep 17 00:00:00 2001 From: Aditya Sadalage Date: Fri, 28 Oct 2022 11:21:27 -0700 Subject: [PATCH 3/5] Updated curl commands --- contrib/gh-runner/gh-runner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/gh-runner/gh-runner.sh b/contrib/gh-runner/gh-runner.sh index 736cccbc74d..20a90e6937d 100644 --- a/contrib/gh-runner/gh-runner.sh +++ b/contrib/gh-runner/gh-runner.sh @@ -38,10 +38,10 @@ elif [ "$(uname -m)" = "x86_64" ]; then echo "Detected amd64 architecture" # Download the latest runner package - curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz + curl -o actions-runner-linux-x64-2.298.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.298.2/actions-runner-linux-x64-2.298.2.tar.gz # Optional: Validate the hash - echo "34a8f34956cdacd2156d4c658cce8dd54c5aef316a16bbbc95eb3ca4fd76429a actions-runner-linux-x64-2.296.2.tar.gz" | shasum -a 256 -c + echo "0bfd792196ce0ec6f1c65d2a9ad00215b2926ef2c416b8d97615265194477117 actions-runner-linux-x64-2.298.2.tar.gz" | shasum -a 256 -c # Extract the installer tar xzf ./actions-runner-linux-x64-2.298.2.tar.gz From a9cda1a245de8d72d299c05dbd3843b1228141cf Mon Sep 17 00:00:00 2001 From: Aditya Sadalage Date: Fri, 28 Oct 2022 11:23:47 -0700 Subject: [PATCH 4/5] Removed empty lines --- contrib/gh-runner/gh-runner.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/contrib/gh-runner/gh-runner.sh b/contrib/gh-runner/gh-runner.sh index 20a90e6937d..68ddb81944a 100644 --- a/contrib/gh-runner/gh-runner.sh +++ b/contrib/gh-runner/gh-runner.sh @@ -24,32 +24,23 @@ newgrp docker & mkdir actions-runner && cd actions-runner if [ "$(uname -m)" = "aarch64" ]; then echo "Detected arm64 architecture" - # Download the latest runner package curl -o actions-runner-linux-arm64-2.298.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.298.2/actions-runner-linux-arm64-2.298.2.tar.gz - # Optional: Validate the hash echo "803e4aba36484ef4f126df184220946bc151ae1bbaf2b606b6e2f2280f5042e8 actions-runner-linux-arm64-2.298.2.tar.gz" | shasum -a 256 -c - # Extract the installer tar xzf ./actions-runner-linux-arm64-2.298.2.tar.gz - elif [ "$(uname -m)" = "x86_64" ]; then echo "Detected amd64 architecture" - # Download the latest runner package curl -o actions-runner-linux-x64-2.298.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.298.2/actions-runner-linux-x64-2.298.2.tar.gz - # Optional: Validate the hash echo "0bfd792196ce0ec6f1c65d2a9ad00215b2926ef2c416b8d97615265194477117 actions-runner-linux-x64-2.298.2.tar.gz" | shasum -a 256 -c - # Extract the installer tar xzf ./actions-runner-linux-x64-2.298.2.tar.gz - else echo "Unrecognized architecture" fi - # Create the runner and start the configuration experience ./config.sh --url https://github.com/dgraph-io/dgraph --token $TOKEN # CI Permission Issue From 14c2787b643d9f3e9c3a73afe9eea74086b1390f Mon Sep 17 00:00:00 2001 From: Aditya Sadalage Date: Fri, 28 Oct 2022 13:26:18 -0700 Subject: [PATCH 5/5] Added exit 1 for unrecognized arch --- contrib/gh-runner/gh-runner.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/gh-runner/gh-runner.sh b/contrib/gh-runner/gh-runner.sh index 68ddb81944a..2fd35382a8a 100644 --- a/contrib/gh-runner/gh-runner.sh +++ b/contrib/gh-runner/gh-runner.sh @@ -40,6 +40,7 @@ elif [ "$(uname -m)" = "x86_64" ]; then tar xzf ./actions-runner-linux-x64-2.298.2.tar.gz else echo "Unrecognized architecture" + exit 1 fi # Create the runner and start the configuration experience ./config.sh --url https://github.com/dgraph-io/dgraph --token $TOKEN