[release-1.21] Bump golang and containerd versions (#4539)

* Bump containerd to v1.4.12-k3s1
* Bump golang to 1.16.10 and sonobuoy to 0.55.0
* Change timeout to 60m

Signed-off-by: Chris Kim <oats87g@gmail.com>
This commit is contained in:
Chris Kim 2021-11-18 21:15:16 -08:00 committed by GitHub
parent 7f737097bc
commit d09821c2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 80 additions and 16 deletions

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.16.8-alpine3.13 ARG GOLANG=golang:1.16.10-alpine3.13
FROM ${GOLANG} FROM ${GOLANG}
ARG http_proxy=$http_proxy ARG http_proxy=$http_proxy

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.16.8-alpine3.13 ARG GOLANG=golang:1.16.10-alpine3.13
FROM ${GOLANG} FROM ${GOLANG}
COPY --from=plugins/manifest:1.2.3 /bin/* /bin/ COPY --from=plugins/manifest:1.2.3 /bin/* /bin/

View File

@ -1,9 +1,9 @@
ARG GOLANG=golang:1.16.8-alpine3.13 ARG GOLANG=golang:1.16.10-alpine3.13
FROM ${GOLANG} FROM ${GOLANG}
RUN apk -U --no-cache add bash git gcc musl-dev docker curl jq coreutils python3 openssl py3-pip RUN apk -U --no-cache add bash git gcc musl-dev docker curl jq coreutils python3 openssl py3-pip
ENV SONOBUOY_VERSION 0.50.0 ENV SONOBUOY_VERSION 0.55.0
RUN OS=linux; \ RUN OS=linux; \
ARCH=$(go env GOARCH); \ ARCH=$(go env GOARCH); \

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.16.8-alpine3.13 ARG GOLANG=golang:1.16.10-alpine3.13
FROM ${GOLANG} FROM ${GOLANG}
RUN apk -U --no-cache add bash jq RUN apk -U --no-cache add bash jq

2
go.mod
View File

@ -9,7 +9,7 @@ replace (
github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0 github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0
github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1 github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1
github.com/containerd/console => github.com/containerd/console v1.0.2 github.com/containerd/console => github.com/containerd/console v1.0.2
github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.11-k3s1 // k3s-release/1.4 github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.12-k3s1 // k3s-release/1.4
github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1 github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1
github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7 // k3s-release/1.4 github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7 // k3s-release/1.4
github.com/containerd/fifo => github.com/containerd/fifo v1.0.0 github.com/containerd/fifo => github.com/containerd/fifo v1.0.0

4
go.sum
View File

@ -526,8 +526,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k3s-io/containerd v1.4.11-k3s1 h1:nSUL3uWxoe1tZy3+bWii9wEBXCvt/+6X8zijx2wSKq0= github.com/k3s-io/containerd v1.4.12-k3s1 h1:WVr0W45uXTIDujMtqsfEigIVuEwhW9E8WjV/06/j03w=
github.com/k3s-io/containerd v1.4.11-k3s1/go.mod h1:g3v4rA/cI6WVYoSAYfUfAnrUSzEgbSZnu7uF1ZzkTmY= github.com/k3s-io/containerd v1.4.12-k3s1/go.mod h1:g3v4rA/cI6WVYoSAYfUfAnrUSzEgbSZnu7uF1ZzkTmY=
github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1 h1:KEz2rd9IDbrQT8w6RibEYlwfTXiu0P6hQDE+6O4IJdI= github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1 h1:KEz2rd9IDbrQT8w6RibEYlwfTXiu0P6hQDE+6O4IJdI=
github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
github.com/k3s-io/cri v1.4.0-k3s.7 h1:1ycdF3dMDJMW/k/UxDC6eMsyGSMZ/p0AoUBVdJvNGQs= github.com/k3s-io/cri v1.4.0-k3s.7 h1:1ycdF3dMDJMW/k/UxDC6eMsyGSMZ/p0AoUBVdJvNGQs=

View File

@ -240,7 +240,7 @@ sonobuoy-test() {
local sonobuoyPID=$! local sonobuoyPID=$!
local code=0 local code=0
time timeout --foreground 30m bash -c test-wait $sonobuoyPID || code=$? time timeout --foreground 60m bash -c test-wait $sonobuoyPID || code=$?
echo "Sonobuoy finished with code $code" echo "Sonobuoy finished with code $code"
retrieve-sonobuoy-logs retrieve-sonobuoy-logs
return $code return $code

View File

@ -15,7 +15,7 @@ os:
- linux - linux
go: go:
- "1.16.8" - "1.16.10"
env: env:
- TRAVIS_GOOS=linux TEST_RUNTIME=io.containerd.runc.v1 TRAVIS_CGO_ENABLED=1 TRAVIS_DISTRO=bionic GOPROXY=direct - TRAVIS_GOOS=linux TEST_RUNTIME=io.containerd.runc.v1 TRAVIS_CGO_ENABLED=1 TRAVIS_DISTRO=bionic GOPROXY=direct

View File

@ -77,7 +77,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "install-golang", type: "shell", run: "once" do |sh| config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
sh.upload_path = "/tmp/vagrant-install-golang" sh.upload_path = "/tmp/vagrant-install-golang"
sh.env = { sh.env = {
'GO_VERSION': ENV['GO_VERSION'] || "1.16.8", 'GO_VERSION': ENV['GO_VERSION'] || "1.16.10",
} }
sh.inline = <<~SHELL sh.inline = <<~SHELL
#!/usr/bin/env bash #!/usr/bin/env bash

View File

@ -19,6 +19,7 @@ package images
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"fmt"
"sort" "sort"
"time" "time"
@ -154,6 +155,10 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
return nil, err return nil, err
} }
if err := validateMediaType(p, desc.MediaType); err != nil {
return nil, errors.Wrapf(err, "manifest: invalid desc %s", desc.Digest)
}
var manifest ocispec.Manifest var manifest ocispec.Manifest
if err := json.Unmarshal(p, &manifest); err != nil { if err := json.Unmarshal(p, &manifest); err != nil {
return nil, err return nil, err
@ -194,6 +199,10 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
return nil, err return nil, err
} }
if err := validateMediaType(p, desc.MediaType); err != nil {
return nil, errors.Wrapf(err, "manifest: invalid desc %s", desc.Digest)
}
var idx ocispec.Index var idx ocispec.Index
if err := json.Unmarshal(p, &idx); err != nil { if err := json.Unmarshal(p, &idx); err != nil {
return nil, err return nil, err
@ -336,6 +345,10 @@ func Children(ctx context.Context, provider content.Provider, desc ocispec.Descr
return nil, err return nil, err
} }
if err := validateMediaType(p, desc.MediaType); err != nil {
return nil, errors.Wrapf(err, "children: invalid desc %s", desc.Digest)
}
// TODO(stevvooe): We just assume oci manifest, for now. There may be // TODO(stevvooe): We just assume oci manifest, for now. There may be
// subtle differences from the docker version. // subtle differences from the docker version.
var manifest ocispec.Manifest var manifest ocispec.Manifest
@ -351,6 +364,10 @@ func Children(ctx context.Context, provider content.Provider, desc ocispec.Descr
return nil, err return nil, err
} }
if err := validateMediaType(p, desc.MediaType); err != nil {
return nil, errors.Wrapf(err, "children: invalid desc %s", desc.Digest)
}
var index ocispec.Index var index ocispec.Index
if err := json.Unmarshal(p, &index); err != nil { if err := json.Unmarshal(p, &index); err != nil {
return nil, err return nil, err
@ -368,6 +385,44 @@ func Children(ctx context.Context, provider content.Provider, desc ocispec.Descr
return descs, nil return descs, nil
} }
// unknownDocument represents a manifest, manifest list, or index that has not
// yet been validated.
type unknownDocument struct {
MediaType string `json:"mediaType,omitempty"`
Config json.RawMessage `json:"config,omitempty"`
Layers json.RawMessage `json:"layers,omitempty"`
Manifests json.RawMessage `json:"manifests,omitempty"`
FSLayers json.RawMessage `json:"fsLayers,omitempty"` // schema 1
}
// validateMediaType returns an error if the byte slice is invalid JSON or if
// the media type identifies the blob as one format but it contains elements of
// another format.
func validateMediaType(b []byte, mt string) error {
var doc unknownDocument
if err := json.Unmarshal(b, &doc); err != nil {
return err
}
if len(doc.FSLayers) != 0 {
return fmt.Errorf("media-type: schema 1 not supported")
}
switch mt {
case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
if len(doc.Manifests) != 0 ||
doc.MediaType == MediaTypeDockerSchema2ManifestList ||
doc.MediaType == ocispec.MediaTypeImageIndex {
return fmt.Errorf("media-type: expected manifest but found index (%s)", mt)
}
case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex:
if len(doc.Config) != 0 || len(doc.Layers) != 0 ||
doc.MediaType == MediaTypeDockerSchema2Manifest ||
doc.MediaType == ocispec.MediaTypeImageManifest {
return fmt.Errorf("media-type: expected index but found manifest (%s)", mt)
}
}
return nil
}
// RootFS returns the unpacked diffids that make up and images rootfs. // RootFS returns the unpacked diffids that make up and images rootfs.
// //
// These are used to verify that a set of layers unpacked to the expected // These are used to verify that a set of layers unpacked to the expected

View File

@ -60,6 +60,10 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R
log.G(ctx).WithError(err).Debug("failed to parse") log.G(ctx).WithError(err).Debug("failed to parse")
continue continue
} }
if u.Scheme != "http" && u.Scheme != "https" {
log.G(ctx).Debug("non-http(s) alternative url is unsupported")
continue
}
log.G(ctx).Debug("trying alternative url") log.G(ctx).Debug("trying alternative url")
// Try this first, parse it // Try this first, parse it

View File

@ -256,6 +256,9 @@ func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor)
if err := json.Unmarshal(b, &m); err != nil { if err := json.Unmarshal(b, &m); err != nil {
return err return err
} }
if len(m.Manifests) != 0 || len(m.Layers) != 0 {
return errors.New("converter: expected schema1 document but found extra keys")
}
c.pulledManifest = &m c.pulledManifest = &m
return nil return nil
@ -474,6 +477,8 @@ type history struct {
type manifest struct { type manifest struct {
FSLayers []fsLayer `json:"fsLayers"` FSLayers []fsLayer `json:"fsLayers"`
History []history `json:"history"` History []history `json:"history"`
Layers json.RawMessage `json:"layers,omitempty"` // OCI manifest
Manifests json.RawMessage `json:"manifests,omitempty"` // OCI index
} }
type v1History struct { type v1History struct {

View File

@ -23,7 +23,7 @@ var (
Package = "github.com/containerd/containerd" Package = "github.com/containerd/containerd"
// Version holds the complete version number. Filled in at linking time. // Version holds the complete version number. Filled in at linking time.
Version = "1.4.11+unknown" Version = "1.4.12+unknown"
// Revision is filled with the VCS (e.g. git) revision being used to build // Revision is filled with the VCS (e.g. git) revision being used to build
// the program at linking time. // the program at linking time.

4
vendor/modules.txt vendored
View File

@ -177,7 +177,7 @@ github.com/containerd/cgroups/v2
github.com/containerd/cgroups/v2/stats github.com/containerd/cgroups/v2/stats
# github.com/containerd/console v1.0.2 => github.com/containerd/console v1.0.2 # github.com/containerd/console v1.0.2 => github.com/containerd/console v1.0.2
github.com/containerd/console github.com/containerd/console
# github.com/containerd/containerd v1.5.1 => github.com/k3s-io/containerd v1.4.11-k3s1 # github.com/containerd/containerd v1.5.1 => github.com/k3s-io/containerd v1.4.12-k3s1
## explicit ## explicit
github.com/containerd/containerd github.com/containerd/containerd
github.com/containerd/containerd/api/events github.com/containerd/containerd/api/events
@ -3195,7 +3195,7 @@ sigs.k8s.io/yaml
# github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0 # github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0
# github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1 # github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1
# github.com/containerd/console => github.com/containerd/console v1.0.2 # github.com/containerd/console => github.com/containerd/console v1.0.2
# github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.11-k3s1 # github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.12-k3s1
# github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1 # github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1
# github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7 # github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7
# github.com/containerd/fifo => github.com/containerd/fifo v1.0.0 # github.com/containerd/fifo => github.com/containerd/fifo v1.0.0