Skip to content

Commit 4e60239

Browse files
authored
Remove vendor dir in /test (microsoft#1417)
Given this slows down development both for us and external contributors as for most changes one would need to run `go mod vendor` in /test to bring in the latest local hcsshim changes, I think it's time we removed this. Pros: 1. Easier for automated tooling like dependabot, and more recently a Microsoft security bot, to make PRs that can just be checked in. All of these automated PRs tend to fail as the bot doesn't know it would need to run go mod vendor in /test as well for our repo. The approach today to check these in is typically someone manually checks out the branch dependabot (or whatever other bot) made, vendor to test, and then push a new commit to those automated PRs and then we can check them in. 2. Speeds up development flow as we don't need to go mod vendor in test before pushing almost every change. 3. Speeds up external contributions as well as there's no extra step to follow to make a change to most things in /internal anymore. We state that this needs to be done in our README, but it's probably a testament to how odd our setup is that it's missed here and there. Cons: 1. We lose the main selling point of vendoring for our test dependencies which is that if one of our dependencies is no longer accessible (deleted, renamed, whatever else) we don't have a local copy included in our repo. This will increase our dependence on the Go modules proxy server which seems like a fair tradeoff, and I think we're fine with this for test dependencies at least. I've removed the references to this extra step in the README as well as got rid of the CI step verifying that the vendor dir was up to date. I don't think we needed the mod=vendor env var either, as since go 1.14 if there's a top level vendor folder I believe the flag is transparently set for commands that accept it. Signed-off-by: Daniel Canter <[email protected]>
1 parent 37ceff7 commit 4e60239

374 files changed

Lines changed: 7 additions & 60065 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ on:
33
- push
44
- pull_request
55

6-
env:
7-
GOFLAGS: -mod=vendor
8-
GOPROXY: off
9-
106
jobs:
117
protos:
128
runs-on: 'windows-2019'
@@ -88,25 +84,6 @@ jobs:
8884
}
8985
exit $process.ExitCode
9086
91-
verify-test-vendor:
92-
runs-on: 'windows-2019'
93-
env:
94-
GOPROXY: "https://proxy.golang.org,direct"
95-
steps:
96-
- uses: actions/checkout@v2
97-
- uses: actions/setup-go@v2
98-
with:
99-
go-version: '^1.17.0'
100-
- name: Validate test modules
101-
shell: powershell
102-
run: |
103-
$currentPath = (Get-Location).Path
104-
$process = Start-Process powershell.exe -PassThru -Verb runAs -Wait -ArgumentList $currentPath/scripts/Verify-GoModules.ps1, $currentPath, "test"
105-
if ($process.ExitCode -ne 0) {
106-
Write-Error "Test package modules are not up to date. Please validate your go version >= this job's and run `go mod vendor` followed by `go mod tidy` in hcsshim/test directory."
107-
}
108-
exit $process.ExitCode
109-
11087
test:
11188
runs-on: ${{ matrix.os }}
11289
strategy:
@@ -119,17 +96,17 @@ jobs:
11996
go-version: '^1.17.0'
12097

12198
- run: go test -gcflags=all=-d=checkptr -v ./... -tags admin
122-
- run: go test -gcflags=all=-d=checkptr -v ./internal -tags admin
123-
working-directory: test
124-
- run: go test -gcflags=all=-d=checkptr -c ./containerd-shim-runhcs-v1/ -tags functional
99+
- run: go test -mod=mod -gcflags=all=-d=checkptr -v ./internal -tags admin
100+
working-directory: test
101+
- run: go test -mod=mod -gcflags=all=-d=checkptr -c ./containerd-shim-runhcs-v1/ -tags functional
125102
working-directory: test
126-
- run: go test -gcflags=all=-d=checkptr -c ./cri-containerd/ -tags functional
103+
- run: go test -mod=mod -gcflags=all=-d=checkptr -c ./cri-containerd/ -tags functional
127104
working-directory: test
128-
- run: go test -gcflags=all=-d=checkptr -c ./functional/ -tags functional
105+
- run: go test -mod=mod -gcflags=all=-d=checkptr -c ./functional/ -tags functional
129106
working-directory: test
130-
- run: go test -gcflags=all=-d=checkptr -c ./runhcs/ -tags functional
107+
- run: go test -mod=mod -gcflags=all=-d=checkptr -c ./runhcs/ -tags functional
131108
working-directory: test
132-
- run: go build -o sample-logging-driver.exe ./cri-containerd/helpers/log.go
109+
- run: go build -mod=mod -o sample-logging-driver.exe ./cri-containerd/helpers/log.go
133110
working-directory: test
134111

135112
- uses: actions/upload-artifact@v2

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,6 @@ certify they either authored the work themselves or otherwise have permission to
7575
more info, as well as to make sure that you can attest to the rules listed. Our CI uses the [DCO Github app](https://github.com/apps/dco) to ensure
7676
that all commits in a given PR are signed-off.
7777

78-
### Test Directory (Important to note)
79-
80-
This project has tried to trim some dependencies from the root Go modules file that would be cumbersome to get transitively included if this
81-
project is being vendored/used as a library. Some of these dependencies were only being used for tests, so the /test directory in this project also has
82-
its own go.mod file where these are now included to get around this issue. Our tests rely on the code in this project to run, so the test Go modules file
83-
has a relative path replace directive to pull in the latest hcsshim code that the tests actually touch from this project
84-
(which is the repo itself on your disk).
85-
86-
```
87-
replace (
88-
github.com/Microsoft/hcsshim => ../
89-
)
90-
```
91-
92-
Because of this, for most code changes you may need to run `go mod vendor` + `go mod tidy` in the /test directory in this repository, as the
93-
CI in this project will check if the files are out of date and will fail if this is true.
94-
95-
9678
## Code of Conduct
9779

9880
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

test/vendor/github.com/Microsoft/go-winio/README.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)