Skip to content

Commit d024133

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents d559b00 + d0240b3 commit d024133

70 files changed

Lines changed: 2084 additions & 638 deletions

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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
go-version: [1.16.3]
23+
go-version: [1.16.4]
2424
os: [ubuntu-18.04, macos-10.15, windows-2019]
2525

2626
steps:
@@ -73,7 +73,7 @@ jobs:
7373
steps:
7474
- uses: actions/setup-go@v2
7575
with:
76-
go-version: '1.16.3'
76+
go-version: '1.16.4'
7777

7878
- uses: actions/checkout@v2
7979
with:
@@ -106,7 +106,7 @@ jobs:
106106
steps:
107107
- uses: actions/setup-go@v2
108108
with:
109-
go-version: '1.16.3'
109+
go-version: '1.16.4'
110110

111111
- name: Set env
112112
shell: bash
@@ -152,7 +152,7 @@ jobs:
152152
steps:
153153
- uses: actions/setup-go@v2
154154
with:
155-
go-version: '1.16.3'
155+
go-version: '1.16.4'
156156
- name: Set env
157157
shell: bash
158158
run: |
@@ -217,7 +217,7 @@ jobs:
217217
strategy:
218218
matrix:
219219
os: [ubuntu-18.04, macos-10.15, windows-2019]
220-
go-version: ['1.16.3']
220+
go-version: ['1.16.4']
221221
include:
222222
# Go 1.13.x is still used by Docker/Moby
223223
- go-version: '1.13.x'
@@ -263,7 +263,7 @@ jobs:
263263
steps:
264264
- uses: actions/setup-go@v2
265265
with:
266-
go-version: '1.16.3'
266+
go-version: '1.16.4'
267267

268268
- uses: actions/checkout@v2
269269
with:
@@ -344,7 +344,7 @@ jobs:
344344
steps:
345345
- uses: actions/setup-go@v2
346346
with:
347-
go-version: '1.16.3'
347+
go-version: '1.16.4'
348348

349349
- uses: actions/checkout@v2
350350
with:
@@ -496,7 +496,7 @@ jobs:
496496
steps:
497497
- uses: actions/setup-go@v2
498498
with:
499-
go-version: '1.16.3'
499+
go-version: '1.16.4'
500500

501501
- uses: actions/checkout@v2
502502
with:

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/setup-go@v2
2020
with:
21-
go-version: '1.16.3'
21+
go-version: '1.16.4'
2222

2323
- uses: actions/checkout@v2
2424
with:
@@ -135,7 +135,7 @@ jobs:
135135
steps:
136136
- uses: actions/setup-go@v2
137137
with:
138-
go-version: '1.16.3'
138+
go-version: '1.16.4'
139139

140140
- uses: actions/checkout@v2
141141
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Install Go
6363
uses: actions/setup-go@v2
6464
with:
65-
go-version: '1.16.3'
65+
go-version: '1.16.4'
6666

6767
- name: Set env
6868
shell: bash

.zuul/playbooks/containerd-build/run.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
become: yes
33
roles:
44
- role: config-golang
5-
go_version: '1.16.3'
5+
go_version: '1.16.4'
66
arch: arm64
77
tasks:
88
- name: Build containerd

Makefile

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414

1515

16+
# Go command to use for build
17+
GO ?= go
18+
1619
# Root directory of the project (absolute path).
1720
ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
1821

@@ -26,9 +29,9 @@ REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet
2629
PACKAGE=github.com/containerd/containerd
2730
SHIM_CGO_ENABLED ?= 0
2831

29-
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
30-
GOOS ?= $(shell go env GOOS)
31-
GOARCH ?= $(shell go env GOARCH)
32+
ifneq "$(strip $(shell command -v $(GO) 2>/dev/null))" ""
33+
GOOS ?= $(shell $(GO) env GOOS)
34+
GOARCH ?= $(shell $(GO) env GOARCH)
3235
else
3336
ifeq ($(GOOS),)
3437
# approximate GOOS for the platform if we don't have Go and GOOS isn't
@@ -85,7 +88,7 @@ GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revi
8588
SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
8689

8790
# Project packages.
88-
PACKAGES=$(shell go list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration)
91+
PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration)
8992
TEST_REQUIRES_ROOT_PACKAGES=$(filter \
9093
${PACKAGES}, \
9194
$(shell \
@@ -122,7 +125,7 @@ TESTFLAGS ?= $(TESTFLAGS_RACE) $(EXTRA_TESTFLAGS)
122125
TESTFLAGS_PARALLEL ?= 8
123126

124127
# Use this to replace `go test` with, for instance, `gotestsum`
125-
GOTEST ?= go test
128+
GOTEST ?= $(GO) test
126129

127130
OUTPUTDIR = $(join $(ROOTDIR), _output)
128131
CRIDIR=$(OUTPUTDIR)/cri
@@ -143,7 +146,7 @@ AUTHORS: .mailmap .git/HEAD
143146

144147
generate: protos
145148
@echo "$(WHALE) $@"
146-
@PATH="${ROOTDIR}/bin:${PATH}" go generate -x ${PACKAGES}
149+
@PATH="${ROOTDIR}/bin:${PATH}" $(GO) generate -x ${PACKAGES}
147150

148151
protos: bin/protoc-gen-gogoctrd ## generate protobuf
149152
@echo "$(WHALE) $@"
@@ -170,7 +173,7 @@ proto-fmt: ## check format of proto files
170173

171174
build: ## build the go packages
172175
@echo "$(WHALE) $@"
173-
@go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} ${EXTRA_FLAGS} ${GO_LDFLAGS} ${PACKAGES}
176+
@$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} ${EXTRA_FLAGS} ${GO_LDFLAGS} ${PACKAGES}
174177

175178
test: ## run tests, except integration tests and tests that require root
176179
@echo "$(WHALE) $@"
@@ -182,12 +185,12 @@ root-test: ## run tests, except integration tests
182185

183186
integration: ## run integration tests
184187
@echo "$(WHALE) $@"
185-
@cd "${ROOTDIR}/integration/client" && go mod download && $(GOTEST) -v ${TESTFLAGS} -test.root -parallel ${TESTFLAGS_PARALLEL} .
188+
@cd "${ROOTDIR}/integration/client" && $(GO) mod download && $(GOTEST) -v ${TESTFLAGS} -test.root -parallel ${TESTFLAGS_PARALLEL} .
186189

187190
# TODO integrate cri integration bucket with coverage
188191
bin/cri-integration.test:
189192
@echo "$(WHALE) $@"
190-
@go test -c ./integration -o bin/cri-integration.test
193+
@$(GO) test -c ./integration -o bin/cri-integration.test
191194

192195
cri-integration: binaries bin/cri-integration.test ## run cri integration tests
193196
@echo "$(WHALE) $@"
@@ -196,13 +199,13 @@ cri-integration: binaries bin/cri-integration.test ## run cri integration tests
196199

197200
benchmark: ## run benchmarks tests
198201
@echo "$(WHALE) $@"
199-
@go test ${TESTFLAGS} -bench . -run Benchmark -test.root
202+
@$(GO) test ${TESTFLAGS} -bench . -run Benchmark -test.root
200203

201204
FORCE:
202205

203206
define BUILD_BINARY
204207
@echo "$(WHALE) $@"
205-
@go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ ${GO_LDFLAGS} ${GO_TAGS} ./$<
208+
@$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ ${GO_LDFLAGS} ${GO_TAGS} ./$<
206209
endef
207210

208211
# Build a binary from a cmd.
@@ -211,15 +214,15 @@ bin/%: cmd/% FORCE
211214

212215
bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
213216
@echo "$(WHALE) bin/containerd-shim"
214-
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
217+
@CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
215218

216219
bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
217220
@echo "$(WHALE) bin/containerd-shim-runc-v1"
218-
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
221+
@CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
219222

220223
bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
221224
@echo "$(WHALE) bin/containerd-shim-runc-v2"
222-
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
225+
@CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
223226

224227
binaries: $(BINARIES) ## build binaries
225228
@echo "$(WHALE) $@"
@@ -235,11 +238,11 @@ genman: man/containerd.8 man/ctr.8
235238

236239
man/containerd.8: FORCE
237240
@echo "$(WHALE) $@"
238-
go run cmd/gen-manpages/main.go $(@F) $(@D)
241+
$(GO) run cmd/gen-manpages/main.go $(@F) $(@D)
239242

240243
man/ctr.8: FORCE
241244
@echo "$(WHALE) $@"
242-
go run cmd/gen-manpages/main.go $(@F) $(@D)
245+
$(GO) run cmd/gen-manpages/main.go $(@F) $(@D)
243246

244247
man/%: docs/man/%.md FORCE
245248
@echo "$(WHALE) $@"
@@ -365,9 +368,9 @@ endif
365368
coverage: ## generate coverprofiles from the unit tests, except tests that require root
366369
@echo "$(WHALE) $@"
367370
@rm -f coverage.txt
368-
@go test -i ${TESTFLAGS} ${PACKAGES} 2> /dev/null
371+
@$(GO) test -i ${TESTFLAGS} ${PACKAGES} 2> /dev/null
369372
@( for pkg in ${PACKAGES}; do \
370-
go test ${TESTFLAGS} \
373+
$(GO) test ${TESTFLAGS} \
371374
-cover \
372375
-coverprofile=profile.out \
373376
-covermode=atomic $$pkg || exit; \
@@ -379,9 +382,9 @@ coverage: ## generate coverprofiles from the unit tests, except tests that requi
379382

380383
root-coverage: ## generate coverage profiles for unit tests that require root
381384
@echo "$(WHALE) $@"
382-
@go test -i ${TESTFLAGS} ${TEST_REQUIRES_ROOT_PACKAGES} 2> /dev/null
385+
@$(GO) test -i ${TESTFLAGS} ${TEST_REQUIRES_ROOT_PACKAGES} 2> /dev/null
383386
@( for pkg in ${TEST_REQUIRES_ROOT_PACKAGES}; do \
384-
go test ${TESTFLAGS} \
387+
$(GO) test ${TESTFLAGS} \
385388
-cover \
386389
-coverprofile=profile.out \
387390
-covermode=atomic $$pkg -test.root || exit; \
@@ -393,8 +396,8 @@ root-coverage: ## generate coverage profiles for unit tests that require root
393396

394397
vendor: ## vendor
395398
@echo "$(WHALE) $@"
396-
@go mod tidy
397-
@go mod vendor
399+
@$(GO) mod tidy
400+
@$(GO) mod vendor
398401

399402
help: ## this help
400403
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

RELEASES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ The current state is available in the following table:
100100
| [1.1](https://github.com/containerd/containerd/releases/tag/v1.1.8) | End of Life | April 23, 2018 | October 23, 2019 |
101101
| [1.2](https://github.com/containerd/containerd/releases/tag/v1.2.13) | End of Life | October 24, 2018 | October 15, 2020 |
102102
| [1.3](https://github.com/containerd/containerd/releases/tag/v1.3.10) | End of Life | September 26, 2019 | March 4, 2021 |
103-
| [1.4](https://github.com/containerd/containerd/releases/tag/v1.4.4) | Active | August 17, 2020 | max(August 17, 2021, release of 1.5.0 + 6 months) |
104-
| [1.5](https://github.com/containerd/containerd/milestone/30) | Next | TBD | max(TBD+1 year, release of 1.6.0 + 6 months) |
103+
| [1.4](https://github.com/containerd/containerd/releases/tag/v1.4.4) | Active | August 17, 2020 | November 3, 2021 (Active), February 3, 2022 (Extended) |
104+
| [1.5](https://github.com/containerd/containerd/releases/tag/v1.5.0) | Active | May 3, 2021 | max(May 3, 2022, release of 1.6.0 + 6 months) |
105+
| [1.6](https://github.com/containerd/containerd/milestone/34) | Next | TBD | max(TBD+1 year, release of 1.7.0 or 2.0.0 + 6 months) |
105106

106107
Note that branches and release from before 1.0 may not follow these rules.
107108

Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Vagrant.configure("2") do |config|
7777
config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
7878
sh.upload_path = "/tmp/vagrant-install-golang"
7979
sh.env = {
80-
'GO_VERSION': ENV['GO_VERSION'] || "1.16.3",
80+
'GO_VERSION': ENV['GO_VERSION'] || "1.16.4",
8181
}
8282
sh.inline = <<~SHELL
8383
#!/usr/bin/env bash

cmd/ctr/commands/snapshots/snapshots.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ var diffCommand = cli.Command{
164164
if err != nil {
165165
return err
166166
}
167+
defer ra.Close()
167168
_, err = io.Copy(os.Stdout, content.NewReader(ra))
168169

169170
return err

content/adaptor_test.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package content
18+
19+
import (
20+
"testing"
21+
22+
"github.com/stretchr/testify/assert"
23+
)
24+
25+
func TestAdaptInfo(t *testing.T) {
26+
tests := []struct {
27+
name string
28+
info Info
29+
fieldpath []string
30+
wantValue string
31+
wantPresent bool
32+
}{
33+
{
34+
"empty fieldpath",
35+
Info{},
36+
[]string{},
37+
"",
38+
false,
39+
},
40+
{
41+
"digest fieldpath",
42+
Info{
43+
Digest: "foo",
44+
},
45+
[]string{"digest"},
46+
"foo",
47+
true,
48+
},
49+
{
50+
"size fieldpath",
51+
Info{},
52+
[]string{"size"},
53+
"",
54+
false,
55+
},
56+
{
57+
"labels fieldpath",
58+
Info{
59+
Labels: map[string]string{
60+
"foo": "bar",
61+
},
62+
},
63+
[]string{"labels", "foo"},
64+
"bar",
65+
true,
66+
},
67+
{
68+
"labels join fieldpath",
69+
Info{
70+
Labels: map[string]string{
71+
"foo.bar.qux": "quux",
72+
},
73+
},
74+
[]string{"labels", "foo", "bar", "qux"},
75+
"quux",
76+
true,
77+
},
78+
}
79+
for _, tt := range tests {
80+
t.Run(tt.name, func(t *testing.T) {
81+
adaptInfo := AdaptInfo(tt.info)
82+
83+
value, present := adaptInfo.Field(tt.fieldpath)
84+
85+
assert.Equal(t, tt.wantValue, value)
86+
assert.Equal(t, tt.wantPresent, present)
87+
})
88+
}
89+
}

content/testsuite/testsuite.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ func checkSmallBlob(ctx context.Context, t *testing.T, store content.Store) {
780780
if err != nil {
781781
t.Fatal(err)
782782
}
783+
defer ra.Close()
783784
r := io.NewSectionReader(ra, 0, readSize)
784785
b, err := ioutil.ReadAll(r)
785786
if err != nil {

0 commit comments

Comments
 (0)