Skip to content

Commit

Permalink
Add alternate way to install gotip (#5618)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
#5601

## Description of the changes
Fixed gotip workflow according to proposal

## How was this change tested?
tested through
https://github.com/EraKin575/test-project/actions/runs/9495245139/job/26167103130

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: EraKin575 <tejaskumar574@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
EraKin575 and yurishkuro committed Jun 15, 2024
1 parent 4d4e710 commit 3d421b7
Showing 1 changed file with 53 additions and 9 deletions.
62 changes: 53 additions & 9 deletions .github/actions/setup-go-tip/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ description: 'Install Go Tip toolchain'
runs:
using: "composite"
steps:
- name: Install Go Tip
- name: Download Go Tip
id: download
shell: bash
run: |
echo Download Go Tip
set -euo pipefail
tip=$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}')
echo "Go Tip version: ${tip}"
retries=10
wait_time=30
retries=3
wait_time=10
success=false
for ((i=1; i<=retries; i++)); do
url="https://storage.googleapis.com/go-build-snap/go/linux-amd64/${tip}.tar.gz"
Expand All @@ -22,20 +24,62 @@ runs:
echo "Failed to download. Retrying in $wait_time seconds..."
sleep $wait_time
done
echo "success=${success}" >> $GITHUB_OUTPUT
if [[ "$success" == false ]]; then
echo "Failed to download Go Tip after $retries attempts"
exit 1
fi
- name: Unpack gotip bundle
if: steps.download.outputs.success == 'true'
shell: bash
run: |
echo Unpack gotip bundle
set -euo pipefail
echo "Downloaded bundle:"
ls -lah gotip.tar.gz
export GOROOT="$HOME/sdk/gotip"
export GOPATH="$HOME/go"
mkdir -p $GOROOT
tar -C $GOROOT -xzf gotip.tar.gz
export PATH="$GOROOT/bin/:$GOPATH/bin:$PATH"
echo "GOROOT=$GOROOT" >> $GITHUB_ENV
# If download failed, we will try to build tip from source.
# This requires Go toolchain, so install it first.
- name: Install Go toolchain
if: steps.download.outputs.success == 'false'
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x

- name: Build Go Tip from source
if: steps.download.outputs.success == 'false'
shell: bash
run: |
echo Build Go Tip from source
set -euo pipefail
go install golang.org/dl/gotip@latest
gotip download
export GOROOT="$(gotip env GOROOT)"
echo "GOROOT=$GOROOT" >> $GITHUB_ENV
# for some reason even though we put gotip at the front of PATH later,
# the go binary installed in previous step still takes precedence. So remove it.
rm -f $(which go)
- name: Setup Go environment
shell: bash
run: |
echo Setup Go environment
set -euo pipefail
$GOROOT/bin/go version
GOPATH="$HOME/gotip"
PATH="$GOROOT/bin:$GOPATH/bin:$PATH"
echo "GOPATH=$GOPATH" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Check Go Version
shell: bash
run: |
echo Check Go Version
set -euo pipefail
echo "GOPATH=$GOPATH"
echo "GOROOT=$GOROOT"
echo "which go:"
which -a go
echo "Active Go version:"
go version

0 comments on commit 3d421b7

Please sign in to comment.