From 2e8c35b506654172243ea46918d27c897fca568c Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Thu, 23 Apr 2020 13:00:34 -0700 Subject: Add basic GitHub labeler workflow. This is the first automated GitHub actions workflow, and it simply applies labels to pull request in a best-effort fashion. PiperOrigin-RevId: 308112191 --- .github/workflows/labeler.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/labeler.yml (limited to '.github/workflows') diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 000000000..b5fd10352 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,11 @@ +name: "Labeler" +on: +- pull_request + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" -- cgit v1.2.3 From 89562b5b2bb186a3bc61412590a25d77f5d8f3e2 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Fri, 1 May 2020 17:48:36 -0700 Subject: Run labeller only for non-forked pull requests. Otherwise the labeller will generate an error each time. PiperOrigin-RevId: 309505731 --- .github/workflows/labeler.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github/workflows') diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index b5fd10352..c09f7eb36 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -7,5 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/labeler@v2 + if: github.base_ref == null with: repo-token: "${{ secrets.GITHUB_TOKEN }}" -- cgit v1.2.3 From f589a85889c815cebac624122aebe14c8263a574 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Thu, 14 May 2020 14:00:52 -0700 Subject: Run issue_reviver via GitHub. PiperOrigin-RevId: 311600872 --- .github/workflows/issue_reviver.yml | 14 ++++++++++++++ tools/bazel.mk | 2 ++ tools/issue_reviver/main.go | 21 ++++++++++++++++----- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/issue_reviver.yml (limited to '.github/workflows') diff --git a/.github/workflows/issue_reviver.yml b/.github/workflows/issue_reviver.yml new file mode 100644 index 000000000..5e0254111 --- /dev/null +++ b/.github/workflows/issue_reviver.yml @@ -0,0 +1,14 @@ +name: "Issue reviver" +on: + schedule: + - cron: '0 0 * * *' + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make run TARGETS="//tools/issue_reviver" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} diff --git a/tools/bazel.mk b/tools/bazel.mk index 4d9bbf0ee..7cb6e393b 100644 --- a/tools/bazel.mk +++ b/tools/bazel.mk @@ -59,6 +59,8 @@ SHELL=/bin/bash -o pipefail ## DOCKER_SOCKET - The Docker socket (default: detected). ## bazel-server-start: load-default ## Starts the bazel server. + @mkdir -p $(BAZEL_CACHE) + @mkdir -p $(GCLOUD_CONFIG) docker run -d --rm \ --init \ --name $(DOCKER_NAME) \ diff --git a/tools/issue_reviver/main.go b/tools/issue_reviver/main.go index 4256f5a6c..47c796b8a 100644 --- a/tools/issue_reviver/main.go +++ b/tools/issue_reviver/main.go @@ -20,6 +20,7 @@ import ( "fmt" "io/ioutil" "os" + "strings" "gvisor.dev/gvisor/tools/issue_reviver/github" "gvisor.dev/gvisor/tools/issue_reviver/reviver" @@ -35,14 +36,22 @@ var ( // Keep the options simple for now. Supports only a single path and repo. func init() { - flag.StringVar(&owner, "owner", "google", "Github project org/owner to look for issues") - flag.StringVar(&repo, "repo", "gvisor", "Github repo to look for issues") + flag.StringVar(&owner, "owner", "", "Github project org/owner to look for issues") + flag.StringVar(&repo, "repo", "", "Github repo to look for issues") flag.StringVar(&tokenFile, "oauth-token-file", "", "Path to file containing the OAUTH token to be used as credential to github") - flag.StringVar(&path, "path", "", "Path to scan for TODOs") + flag.StringVar(&path, "path", ".", "Path to scan for TODOs") flag.BoolVar(&dryRun, "dry-run", false, "If set to true, no changes are made to issues") } func main() { + // Set defaults from the environment. + repository := os.Getenv("GITHUB_REPOSITORY") + if parts := strings.SplitN(repository, "/", 2); len(parts) == 2 { + owner = parts[0] + repo = parts[1] + } + + // Parse flags. flag.Parse() // Check for mandatory parameters. @@ -62,8 +71,10 @@ func main() { os.Exit(1) } - // Token is passed as a file so it doesn't show up in command line arguments. - var token string + // The access token may be passed as a file so it doesn't show up in + // command line arguments. It also may be provided through the + // environment to faciliate use through GitHub's CI system. + token := os.Getenv("GITHUB_TOKEN") if len(tokenFile) != 0 { bytes, err := ioutil.ReadFile(tokenFile) if err != nil { -- cgit v1.2.3 From cbfb55869e4d00ddd1ede096ba01adf2713e08b1 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Mon, 18 May 2020 14:34:49 -0700 Subject: Implement Go branch updater with GitHub actions. PiperOrigin-RevId: 312155686 --- .github/workflows/go.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/go_branch.sh | 5 ++-- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/go.yml (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 000000000..60704f144 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,63 @@ +name: "Go" +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - 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 }}" + - uses: actions/checkout@v2 + 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- + - run: make build TARGETS="//:gopath" + - run: tools/go_branch.sh + - run: git checkout go && git clean -f + - run: go build ./... + - if: github.event_name == 'push' + run: | + # Required dedicated credentials for the Go branch, due to the way + # branch protection rules are configured. + git config --global credential.helper cache + echo -e "protocol=https\nhost=github.com\nusername=${{ secrets.GO_TOKEN }}\npassword=x-oauth-basic" | git credential approve + git remote add upstream "https://github.com/${{ github.repository }}" + git push upstream go:go + - if: ${{ success() }} + 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() }} + 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 }}" diff --git a/tools/go_branch.sh b/tools/go_branch.sh index f97a74aaf..e568a0a76 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -eo pipefail +set -xeo pipefail # Discovery the package name from the go.mod file. declare -r module=$(cat go.mod | grep -E "^module" | cut -d' ' -f2) @@ -42,7 +42,8 @@ declare -r head=$(git describe --always) # We expect to have an existing go branch that we will use as the basis for # this commit. That branch may be empty, but it must exist. -declare -r go_branch=$(git show-ref --hash origin/go) +git fetch --all +declare -r go_branch=$(git show-ref --hash go) # Clone the current repository to the temporary directory, and check out the # current go_branch directory. We move to the new repository for convenience. -- cgit v1.2.3 From f2f2dec7280e37696550185f291d51cf9e47e281 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Mon, 18 May 2020 14:51:53 -0700 Subject: Add simplified badge and Build workflow. PiperOrigin-RevId: 312159017 --- .github/workflows/build.yml | 21 +++++++++++++++++++++ README.md | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..cf782a580 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,21 @@ +name: "Build" +on: + push: + branches: + - master + pull_request: + branches: + - master + +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 diff --git a/README.md b/README.md index 04131977f..b1ed3b4ce 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ ![gVisor](g3doc/logo.png) -[![Status](https://storage.googleapis.com/gvisor-build-badges/build.svg)](https://storage.googleapis.com/gvisor-build-badges/build.html) -[![gVisor chat](https://badges.gitter.im/gvisor/community.png)](https://gitter.im/gvisor/community) +![](https://github.com/google/gvisor/workflows/Build/badge.svg) ## What is gVisor? -- cgit v1.2.3 From 8437ef752d3c8e90327edad0164f3e4d003821c8 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Wed, 20 May 2020 22:22:00 -0700 Subject: Normalize permissions in the go branch. Fixes #2722 --- .github/workflows/go.yml | 5 +++-- tools/go_branch.sh | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 60704f144..744d25c92 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,6 +17,7 @@ jobs: -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 with: fetch-depth: 0 @@ -47,14 +48,14 @@ jobs: echo -e "protocol=https\nhost=github.com\nusername=${{ secrets.GO_TOKEN }}\npassword=x-oauth-basic" | git credential approve git remote add upstream "https://github.com/${{ github.repository }}" git push upstream go:go - - if: ${{ success() }} + - 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() }} + - if: ${{ failure() && github.event_name == 'pull_request' }} run: | jq -nc '{"state": "failure", "context": "go tests"}' | \ curl -sL -X POST -d @- \ diff --git a/tools/go_branch.sh b/tools/go_branch.sh index e568a0a76..093de89b4 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -88,6 +88,12 @@ EOF # because they may correspond to unused templates, etc. cp "${repo_orig}"/runsc/*.go runsc/ +# Normalize all permissions. The way bazel constructs the :gopath tree may leave +# some strange permissions on files. We don't have anything in this tree that +# should be execution, only the Go source files, README.md, and ${othersrc}. +find . -type f -exec chmod 0644 {} \; +find . -type d -exec chmod 0755 {} \; + # Update the current working set and commit. git add . && git commit -m "Merge ${head} (automated)" -- cgit v1.2.3 From 0bc022b7f3c13bb7c5c8d47d1781820161e7b1ad Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Wed, 27 May 2020 10:47:42 -0700 Subject: Fix push for Go branch. PiperOrigin-RevId: 313419745 --- .github/workflows/go.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 744d25c92..10c86f5cd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -19,6 +19,12 @@ jobs: "${{ github.event.pull_request.statuses_url }}" if: github.event_name == 'pull_request' - uses: actions/checkout@v2 + if: github.event_name == 'push' + with: + fetch-depth: 0 + token: '${{ secrets.GO_TOKEN }}' + - uses: actions/checkout@v2 + if: github.event_name == 'pull_request' with: fetch-depth: 0 - uses: actions/setup-go@v2 @@ -42,10 +48,6 @@ jobs: - run: go build ./... - if: github.event_name == 'push' run: | - # Required dedicated credentials for the Go branch, due to the way - # branch protection rules are configured. - git config --global credential.helper cache - echo -e "protocol=https\nhost=github.com\nusername=${{ secrets.GO_TOKEN }}\npassword=x-oauth-basic" | git credential approve git remote add upstream "https://github.com/${{ github.repository }}" git push upstream go:go - if: ${{ success() && github.event_name == 'pull_request' }} -- cgit v1.2.3 From 8d8dce418f7e4053f80b035ff257743b431859d9 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Fri, 5 Jun 2020 16:50:47 -0700 Subject: Add stale issue & PR cleanup. PiperOrigin-RevId: 315020368 --- .github/workflows/stale.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/stale.yml (limited to '.github/workflows') diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..0b31fecf5 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,20 @@ +name: "Close stale issues" +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-label: 'stale' + stale-pr-label: 'stale' + exempt-issue-labels: 'exported, type: bug, type: cleanup, type: enhancement, type: process, type: proposal, type: question' + exempt-pr-labels: 'ready to pull' + stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 30 days.' + stale-pr-message: 'This pull request is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 30 days.' + days-before-stale: 90 + days-before-close: 30 -- cgit v1.2.3 From 74df310ac09f9f27bc88a9b7eda0fa1659e499a4 Mon Sep 17 00:00:00 2001 From: Ian Lewis Date: Mon, 13 Jul 2020 15:05:27 -0700 Subject: Don't run issue reviver on forks. Add a conditional to avoid running the issue reviver on forks. It will always cause errors since bug references in the source code don't match issue IDs in forked repos. PiperOrigin-RevId: 321042060 --- .github/workflows/issue_reviver.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/issue_reviver.yml b/.github/workflows/issue_reviver.yml index 5e0254111..e68e15270 100644 --- a/.github/workflows/issue_reviver.yml +++ b/.github/workflows/issue_reviver.yml @@ -4,11 +4,13 @@ on: - cron: '0 0 * * *' jobs: - label: + issue_reviver: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + if: github.repository == "google/gvisor" - run: make run TARGETS="//tools/issue_reviver" + if: github.repository == "google/gvisor" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY: ${{ github.repository }} -- cgit v1.2.3 From a05ea20ef1107cc0a4ace94d6dffd7c7e590b264 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Tue, 28 Jul 2020 09:39:08 -0700 Subject: Don't attempt to use the secret if it does not exist. Fixes #3326 PiperOrigin-RevId: 323589669 --- .github/workflows/go.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 10c86f5cd..a81d06cca 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,7 +11,13 @@ jobs: generate: runs-on: ubuntu-latest steps: - - run: | + - id: setup + run: | + if ! [[ -z "${{ secrets.GO_TOKEN }}" ]]; then + echo ::set-output has_token=true + else + echo ::set-output has_token=false + fi jq -nc '{"state": "pending", "context": "go tests"}' | \ curl -sL -X POST -d @- \ -H "Content-Type: application/json" \ @@ -19,12 +25,12 @@ jobs: "${{ github.event.pull_request.statuses_url }}" if: github.event_name == 'pull_request' - uses: actions/checkout@v2 - if: github.event_name == 'push' + if: github.event_name == 'push' && steps.setup.outputs.has_token == 'true' with: fetch-depth: 0 token: '${{ secrets.GO_TOKEN }}' - uses: actions/checkout@v2 - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || steps.setup.outputs.has_token != 'true' with: fetch-depth: 0 - uses: actions/setup-go@v2 -- cgit v1.2.3 From cb1a3ba63a4a44cf929bb7a1449e76e7664923ff Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Thu, 30 Jul 2020 09:57:02 -0700 Subject: Fix merge flow for Go branch. PiperOrigin-RevId: 324024075 --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a81d06cca..18b805c15 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,6 +18,7 @@ jobs: else echo ::set-output has_token=false fi + - run: | jq -nc '{"state": "pending", "context": "go tests"}' | \ curl -sL -X POST -d @- \ -H "Content-Type: application/json" \ -- cgit v1.2.3 From a7d9aa6d5bfbed11c94578c6a2eb04ce75cbdbe5 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Fri, 31 Jul 2020 16:06:13 -0700 Subject: Use proper set-output syntax. PiperOrigin-RevId: 324302828 --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 18b805c15..0869fb8db 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,9 +14,9 @@ jobs: - id: setup run: | if ! [[ -z "${{ secrets.GO_TOKEN }}" ]]; then - echo ::set-output has_token=true + echo ::set-output name=has_token::true else - echo ::set-output has_token=false + echo ::set-output name=has_token::false fi - run: | jq -nc '{"state": "pending", "context": "go tests"}' | \ -- cgit v1.2.3 From 10f6c41bbd5dbc84c57aedb4cb86e7dfd59a8114 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Mon, 3 Aug 2020 09:07:43 -0700 Subject: Include shim binaries in the Go branch. PiperOrigin-RevId: 324615016 --- .github/workflows/go.yml | 4 +++- README.md | 19 +++++++++++++------ tools/go_branch.sh | 22 ++++++++++++++++++---- 3 files changed, 34 insertions(+), 11 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0869fb8db..4da3853b2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -49,7 +49,9 @@ jobs: key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }} restore-keys: | ${{ runner.os }}-bazel- - - run: make build TARGETS="//:gopath" + - run: | + rm -rf bazel-bin/gopath + make build TARGETS="//:gopath" - run: tools/go_branch.sh - run: git checkout go && git clean -f - run: go build ./... diff --git a/README.md b/README.md index 0e3d96b68..ed9e0e92b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Make sure the following dependencies are installed: Build and install the `runsc` binary: -``` +```sh make runsc sudo cp ./bazel-bin/runsc/linux_amd64_pure_stripped/runsc /usr/local/bin ``` @@ -67,14 +67,14 @@ sudo cp ./bazel-bin/runsc/linux_amd64_pure_stripped/runsc /usr/local/bin To run standard test suites, you can use: -``` +```sh make unit-tests make tests ``` To run specific tests, you can specify the target: -``` +```sh make test TARGETS="//runsc:version_test" ``` @@ -84,12 +84,19 @@ This project uses [bazel][bazel] to build and manage dependencies. A synthetic `go` branch is maintained that is compatible with standard `go` tooling for convenience. -For example, to build `runsc` directly from this branch: +For example, to build and install `runsc` directly from this branch: -``` +```sh echo "module runsc" > go.mod GO111MODULE=on go get gvisor.dev/gvisor/runsc@go -CGO_ENABLED=0 GO111MODULE=on go install gvisor.dev/gvisor/runsc +CGO_ENABLED=0 GO111MODULE=on sudo -E go build -o /usr/local/bin/runsc gvisor.dev/gvisor/runsc +``` + +Subsequently, you can build and install the shim binaries for `containerd`: + +```sh +GO111MODULE=on sudo -E go build -o /usr/local/bin/gvisor-containerd-shim gvisor.dev/gvisor/shim/v1 +GO111MODULE=on sudo -E go build -o /usr/local/bin/containerd-shim-runsc-v1 gvisor.dev/gvisor/shim/v2 ``` Note that this branch is supported in a best effort capacity, and direct diff --git a/tools/go_branch.sh b/tools/go_branch.sh index 093de89b4..e5c060024 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -40,10 +40,15 @@ trap finish EXIT # Record the current working commit. declare -r head=$(git describe --always) -# We expect to have an existing go branch that we will use as the basis for -# this commit. That branch may be empty, but it must exist. +# We expect to have an existing go branch that we will use as the basis for this +# commit. That branch may be empty, but it must exist. We search for this branch +# using the local branch, the "origin" branch, and other remotes, in order. git fetch --all -declare -r go_branch=$(git show-ref --hash go) +declare -r go_branch=$( \ + git show-ref --hash refs/heads/go || \ + git show-ref --hash refs/remotes/origin/go || \ + git show-ref --hash go | head -n 1 \ +) # Clone the current repository to the temporary directory, and check out the # current go_branch directory. We move to the new repository for convenience. @@ -66,6 +71,11 @@ git checkout -b go "${go_branch}" git merge --no-commit --strategy ours ${head} || \ git merge --allow-unrelated-histories --no-commit --strategy ours ${head} +# Normalize the permissions on the old branch. Note that they should be +# normalized if constructed by this tool, but we do so before the rsync. +find . -type f -exec chmod 0644 {} \; +find . -type d -exec chmod 0755 {} \; + # Sync the entire gopath_dir. rsync --recursive --verbose --delete --exclude .git -L "${gopath_dir}/" . @@ -86,7 +96,11 @@ EOF # There are a few solitary files that can get left behind due to the way bazel # constructs the gopath target. Note that we don't find all Go files here # because they may correspond to unused templates, etc. -cp "${repo_orig}"/runsc/*.go runsc/ +declare -ar binaries=( "runsc" "shim/v1" "shim/v2" ) +for target in "${binaries[@]}"; do + mkdir -p "${target}" + cp "${repo_orig}/${target}"/*.go "${target}/" +done # Normalize all permissions. The way bazel constructs the :gopath tree may leave # some strange permissions on files. We don't have anything in this tree that -- cgit v1.2.3 From e3c349d21957edbc124647e122f5d07e2e853690 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Mon, 3 Aug 2020 11:20:31 -0700 Subject: Fix syntax error in issue_reviver. PiperOrigin-RevId: 324642975 --- .github/workflows/issue_reviver.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/issue_reviver.yml b/.github/workflows/issue_reviver.yml index e68e15270..2b399a3f2 100644 --- a/.github/workflows/issue_reviver.yml +++ b/.github/workflows/issue_reviver.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - if: github.repository == "google/gvisor" + if: github.repository == 'google/gvisor' - run: make run TARGETS="//tools/issue_reviver" - if: github.repository == "google/gvisor" + if: github.repository == 'google/gvisor' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY: ${{ github.repository }} -- cgit v1.2.3