Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor protobuf tools #1592

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,47 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

# protobuild requires the code to be in $GOPATH to translate from github.com/Microsoft/hcsshim
# to the correct path on disk
- uses: actions/checkout@v3
with:
path: "go/src/github.com/Microsoft/hcsshim"
# Install protoc-gen-gogoctrd in D:\bin
- uses: actions/checkout@v3
with:
repository: containerd/containerd
ref: v1.6.2
path: "containerd"
- name: Install protoc-gen-gogoctrd
shell: powershell
run: |
cd containerd
go build ./cmd/protoc-gen-gogoctrd
mkdir D:\bin
mv protoc-gen-gogoctrd.exe D:\bin
path: "${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim"

# Install protoc in D:\bin
- name: Install protoc
shell: powershell
run: |
Invoke-WebRequest -OutFile protoc.zip -Uri https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win32.zip
curl.exe -L --no-progress-meter -o protoc.zip `
https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win32.zip
helsaawy marked this conversation as resolved.
Show resolved Hide resolved

Expand-Archive -Path protoc.zip -DestinationPath .
mv include go/src/github.com/Microsoft/hcsshim/protobuf

mkdir -f ${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim/protobuf
mv include/* ${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim/protobuf

mkdir -f D:\bin
mv bin\protoc.exe D:\bin
- name: Run Protobuild

- name: Run protobuild
shell: powershell
run: |
go install github.com/containerd/protobuild@v0.2.0
cd go\src\github.com\Microsoft\hcsshim
# Install protobuild and gogoctrd; rely on tools.go to vendor correct dependencies
go install github.com/containerd/protobuild
go install github.com/containerd/containerd/cmd/protoc-gen-gogoctrd

$Env:Path += ";D:\bin;" + $Env:GOPATH + "\bin"
protobuild $(go list ./... | grep -v /vendor/)
$env:Path += ";D:\bin;$env:GOPATH\bin"
Write-Output "::group::protobuild"
protobuild $( go list ./... | Where-Object { $_ -notmatch 'vendor' } )
Write-Output "::endgroup::"

git add --all --intent-to-add .
Write-Output "::group::git diff"
git diff --exit-code
Write-Output "::endgroup::"
working-directory: "${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim"
env:
GOPATH: '${{ github.workspace }}\go'
GOFLAGS: ""
GOPROXY: ""

verify-vendor:
runs-on: "windows-2019"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ rootfs-conv/*
deps/*
out/*

# protobuf files
/protobuf/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also have "protobuf/*" without the root slash?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, i ran into an issue where a vendored module had a folder called protobuf, and it caused all kinds of shenanigans 😅


# test results
test/results

Expand Down
9 changes: 4 additions & 5 deletions Protobuild.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ version = "1"
generator = "gogoctrd"
plugins = ["grpc", "fieldpath"]

# Control protoc include paths. Below are usually some good defaults, but feel
# free to try it without them if it works for your project.
[includes]
# Include paths that will be added before all others. Typically, you want to
# treat the root of the project as an include, but this may not be necessary.
before = ["./protobuf"]

# override default of ["usr/local/include", "/usr/include"]
after = []

katiewasnothere marked this conversation as resolved.
Show resolved Hide resolved
# Paths that should be treated as include roots in relation to the vendor
# directory. These will be calculated with the vendor directory nearest the
# target package.
Expand Down Expand Up @@ -45,4 +44,4 @@ plugins = ["ttrpc"]

[[overrides]]
prefixes = ["github.com/Microsoft/hcsshim/internal/vmservice"]
plugins = ["ttrpc"]
plugins = ["ttrpc"]
Empty file.
Empty file.
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ require (
go.opencensus.io v0.23.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
google.golang.org/grpc v1.47.0
google.golang.org/grpc v1.48.0
)

require github.com/josephspurrier/goversioninfo v1.4.0
require (
github.com/containerd/protobuild v0.3.0
github.com/josephspurrier/goversioninfo v1.4.0
)

require (
github.com/OneOfOne/xxhash v1.2.8 // indirect
Expand All @@ -61,6 +64,7 @@ require (
github.com/moby/sys/mountinfo v0.5.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ github.com/containerd/imgcrypt v1.1.4/go.mod h1:LorQnPtzL/T0IyCeftcsMEO7AqxUDbdO
github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c=
github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY=
github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY=
github.com/containerd/protobuild v0.3.0 h1:RIyEIu+D+iIha6E1PREBPAXspSMFaDVam81JlolZWpg=
github.com/containerd/protobuild v0.3.0/go.mod h1:5mNMFKKAwCIAkFBPiOdtRx2KiQlyEJeMXnL5R1DsWu8=
github.com/containerd/stargz-snapshotter/estargz v0.4.1/go.mod h1:x7Q9dg9QYb4+ELgxmo4gBUeJB0tl5dqH1Sdz0nJU1QM=
github.com/containerd/stargz-snapshotter/estargz v0.12.0 h1:idtwRTLjk2erqiYhPWy2L844By8NRFYEwYHcXhoIWPM=
github.com/containerd/stargz-snapshotter/estargz v0.12.0/go.mod h1:AIQ59TewBFJ4GOPEQXujcrJ/EKxh5xXZegW1rkR1P/M=
Expand Down Expand Up @@ -987,6 +989,7 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/peterh/liner v0.0.0-20170211195444-bf27d3ba8e1d/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
Expand Down
84 changes: 42 additions & 42 deletions internal/computeagent/computeagent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions internal/computeagent/computeagent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";

option go_package = "github.com/Microsoft/hcsshim/internal/computeagent;computeagent";

import weak "gogoproto/gogo.proto";
import "google/protobuf/any.proto";

service ComputeAgent{
Expand All @@ -17,7 +16,7 @@ message AssignPCIInternalRequest {
string container_id = 1;
string device_id = 2;
uint32 virtual_function_index = 3;
string nic_id = 4;
string nic_id = 4;
}

message AssignPCIInternalResponse {
Expand Down Expand Up @@ -58,6 +57,6 @@ message DeleteNICInternalResponse {}

message IovSettings {
uint32 IovOffloadWeight = 1;
uint32 QueuePairsRequested = 2;
uint32 QueuePairsRequested = 2;
uint32 InterruptModeration = 3;
}
25 changes: 12 additions & 13 deletions internal/extendedtask/extendedtask.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions internal/extendedtask/extendedtask.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ syntax = "proto3";

option go_package = "github.com/Microsoft/hcsshim/internal/extendedtask;extendedtask";

import weak "gogoproto/gogo.proto";

service ExtendedTask {
rpc ComputeProcessorInfo(ComputeProcessorInfoRequest) returns (ComputeProcessorInfoResponse);
}

message ComputeProcessorInfoRequest {
string id = 1;
string id = 1;
}

message ComputeProcessorInfoResponse {
int32 count = 1;
int32 count = 1;
}
Loading