Include shim binaries in the Go branch.
PiperOrigin-RevId: 324615016
This commit is contained in:
parent
d5b31458aa
commit
10f6c41bbd
|
@ -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 ./...
|
||||
|
|
19
README.md
19
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue