mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix Go branch building.
Files removed from the working tree were not being properly removed from the branch, leading to symbol conflicts while building. This requires the change to 'git add --all' in the tools/go_branch.sh script. But why was this not caught by CI? The "git clean -f" command by default only cleans files in the current working directory. In order to clean the whole tree recursively, we need to specify a pathspec, which is ".". In addition to these fixes, re-add the "go tests" command to help prevent this from happening again, since merges on the Go branch will happen in GitHub actions for simplicity. The Go test is retained in BuildKite. PiperOrigin-RevId: 351503804
This commit is contained in:
committed by
gVisor bot
parent
62b4c2f517
commit
e74aa25e22
@@ -34,7 +34,7 @@ steps:
|
||||
label: ":golang: Go branch"
|
||||
commands:
|
||||
- tools/go_branch.sh
|
||||
- git checkout go && git clean -f
|
||||
- git checkout go && git clean -xf .
|
||||
- go build ./...
|
||||
|
||||
# Release workflow.
|
||||
|
||||
@@ -9,19 +9,14 @@ name: "Build"
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
- master
|
||||
- "feature/**"
|
||||
|
||||
jobs:
|
||||
default:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/bazel
|
||||
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bazel-
|
||||
- run: make
|
||||
- run: make build OPTIONS="--build_tag_filters nogo" TARGETS="//..."
|
||||
- run: make run TARGETS="//tools/github" ARGS="-path=bazel-bin/ -path=bazel-out/ nogo"
|
||||
|
||||
+31
-16
@@ -7,6 +7,10 @@ name: "Go"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- "feature/**"
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
@@ -19,31 +23,42 @@ jobs:
|
||||
else
|
||||
echo ::set-output name=has_token::false
|
||||
fi
|
||||
- run: |
|
||||
jq -nc '{"state": "pending", "context": "go tests"}' | \
|
||||
curl -sL -X POST -d @- \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ github.event.pull_request.statuses_url }}"
|
||||
if: github.event_name == 'pull_request'
|
||||
- uses: actions/checkout@v2
|
||||
if: steps.setup.outputs.has_token == 'true'
|
||||
if: github.event_name == 'push' && steps.setup.outputs.has_token == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: '${{ secrets.GO_TOKEN }}'
|
||||
- uses: actions/checkout@v2
|
||||
if: steps.setup.outputs.has_token != 'true'
|
||||
if: github.event_name == 'pull_request' || steps.setup.outputs.has_token != 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/bazel
|
||||
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bazel-
|
||||
go-version: 1.15
|
||||
- run: tools/go_branch.sh
|
||||
- run: |
|
||||
- run: git checkout go && git clean -xf . && go build ./...
|
||||
- if: github.event_name == 'push'
|
||||
run: |
|
||||
git remote add upstream "https://github.com/${{ github.repository }}"
|
||||
git push upstream go:go
|
||||
- if: ${{ success() && github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
jq -nc '{"state": "success", "context": "go tests"}' | \
|
||||
curl -sL -X POST -d @- \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ github.event.pull_request.statuses_url }}"
|
||||
- if: ${{ failure() && github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
jq -nc '{"state": "failure", "context": "go tests"}' | \
|
||||
curl -sL -X POST -d @- \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ github.event.pull_request.statuses_url }}"
|
||||
|
||||
+5
-7
@@ -37,11 +37,9 @@ readonly module origpwd othersrc
|
||||
# Build an amd64 & arm64 gopath.
|
||||
declare -r go_amd64="${tmp_dir}/amd64"
|
||||
declare -r go_arm64="${tmp_dir}/arm64"
|
||||
rm -rf bazel-bin/gopath
|
||||
make build BAZEL_OPTIONS="" TARGETS="//:gopath"
|
||||
make build BAZEL_OPTIONS="" TARGETS="//:gopath" 2>/dev/null
|
||||
rsync --recursive --delete --copy-links bazel-bin/gopath/ "${go_amd64}"
|
||||
rm -rf bazel-bin/gopath
|
||||
make build BAZEL_OPTIONS=--config=cross-aarch64 TARGETS="//:gopath"
|
||||
make build BAZEL_OPTIONS=--config=cross-aarch64 TARGETS="//:gopath" 2>/dev/null
|
||||
rsync --recursive --delete --copy-links bazel-bin/gopath/ "${go_arm64}"
|
||||
|
||||
# Strip irrelevant files, i.e. use only arm64 files from the arm64 build.
|
||||
@@ -69,8 +67,8 @@ cross_check "${go_amd64}" "${go_arm64}"
|
||||
|
||||
# Merge the two for a complete set of source files.
|
||||
declare -r go_merged="${tmp_dir}/merged"
|
||||
rsync --recursive --update "${go_amd64}/" "${go_merged}"
|
||||
rsync --recursive --update "${go_arm64}/" "${go_merged}"
|
||||
rsync --recursive "${go_amd64}/" "${go_merged}"
|
||||
rsync --recursive "${go_arm64}/" "${go_merged}"
|
||||
|
||||
# Record the current working commit.
|
||||
declare head
|
||||
@@ -161,7 +159,7 @@ find . -type d -exec chmod 0755 {} \;
|
||||
# branch, then we have nothing to commit here. So allow empty commit. This can
|
||||
# occur when this script is run parallely (via pull_request and push events)
|
||||
# and the push workflow finishes before the pull_request workflow can run this.
|
||||
git add . && git commit --allow-empty -m "Merge ${head} (automated)"
|
||||
git add --all && git commit --allow-empty -m "Merge ${head} (automated)"
|
||||
|
||||
# Push the branch back to the original repository.
|
||||
git remote add orig "${repo_orig}" && git push -f orig go:go
|
||||
|
||||
Reference in New Issue
Block a user