diff --git a/go.mod b/go.mod index e5e1b839a9a..16d33dadf12 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 github.com/pkg/errors v0.9.1 - github.com/tektoncd/plumbing v0.0.0-20220728121531-8a725746af4f + github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb go.opencensus.io v0.23.0 go.uber.org/zap v1.21.0 golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b diff --git a/go.sum b/go.sum index 6b387612988..0d5f1331bf6 100644 --- a/go.sum +++ b/go.sum @@ -1317,8 +1317,9 @@ github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0 github.com/tektoncd/ahmetb-gen-crd-api-reference-docs v0.3.1-0.20220729140133-6ce2d5aafcb4 h1:E5MV/fepEo6WUfYi+rE5y4oL5BUncZmO7e1FJm7F+sI= github.com/tektoncd/ahmetb-gen-crd-api-reference-docs v0.3.1-0.20220729140133-6ce2d5aafcb4/go.mod h1:lQON0TD5PnAUl7Q6H5FNV+/AqCSeltYf72OGIkegB/o= github.com/tektoncd/plumbing v0.0.0-20220304154415-13228ac1f4a4/go.mod h1:b9esRuV1absBvaPzKkjYdKXjC5Tgs8/vh1sz++RiTdc= -github.com/tektoncd/plumbing v0.0.0-20220728121531-8a725746af4f h1:0yfTcfbYoWluJ7jj3ldBeNdahE7pIAXqTioQpAe3EGo= github.com/tektoncd/plumbing v0.0.0-20220728121531-8a725746af4f/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= +github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb h1:LUUCR8pLF+MzdQ7kOQQrMzDahIPZLdPCzfnNow1Um3Y= +github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= github.com/tektoncd/resolution v0.0.0-20220331203013-e4203c70c5eb h1:bSrsnmoOJJh1JorlaTDSusq/eIBnk5zRKAVXOhnJyD8= github.com/tektoncd/resolution v0.0.0-20220331203013-e4203c70c5eb/go.mod h1:u7+LospaKMTW8f1mKHpul2XmGXYSG86kMrbJqUr2w0Q= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= diff --git a/tekton/publish.yaml b/tekton/publish.yaml index 39e0aeb82a2..886c570c036 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -96,6 +96,7 @@ spec: # Combine Distroless with a Windows base image, used for the entrypoint image. COMBINED_BASE_IMAGE=$(go run ./vendor/github.com/tektoncd/plumbing/cmd/combine/main.go \ ghcr.io/distroless/static \ + mcr.microsoft.com/windows/nanoserver:ltsc2019 \ mcr.microsoft.com/windows/nanoserver:ltsc2022 \ ${CONTAINER_REGISTRY}/$(params.package)/combined-base-image:latest) diff --git a/vendor/github.com/tektoncd/plumbing/cmd/combine/README.md b/vendor/github.com/tektoncd/plumbing/cmd/combine/README.md index 7dc30e1fd0e..e1f1419d57a 100644 --- a/vendor/github.com/tektoncd/plumbing/cmd/combine/README.md +++ b/vendor/github.com/tektoncd/plumbing/cmd/combine/README.md @@ -1,39 +1,50 @@ # combine manifest lists -This tool combines two Docker manifest lists ("multi-arch images") into one that provides all the platforms supported by both manifest lists. +This tool combines two or more Docker manifest lists ("multi-arch images") into one that provides all the platforms supported by all the specified base image manifest lists. -It fails if both images provide the same platforms, or if either isn't a manifest list. +It fails if any images provide the same platforms, or if any isn't a manifest list. # demo ``` $ go run ./ \ - gcr.io/distroless/static:nonroot \ - mcr.microsoft.com/windows/nanoserver:1809 \ - gcr.io/imjasonh/combined + ghcr.io/distroless/static \ + mcr.microsoft.com/windows/nanoserver:ltsc2022 \ + mcr.microsoft.com/windows/nanoserver:ltsc2019 \ + gcr.io/MY_PROJECT/combined ``` -This combines the [distroless](https://github.com/googlecontainertools/distroless) image providing linux platform support with an image providing Windows support. +This combines a [distroless](https://github.com/distroless/static) base image providing Linux platform support, with two image providing different versions of a Windows base image. The general form of the command args is: ``` -combine src1 src2 dst +combine src1 src2 [src...] dst ``` -(combine two source manifest lists and push to the `dst` reference). +(combine two or more source manifest lists and push to the `dst` reference). After running the script, you can check the image's platforms using [`crane`](https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md): ``` -$ crane manifest gcr.io/imjasonh/combined | jq '.manifests[].platform' +$ crane manifest gcr.io/MY_PROJECT/combined | jq '.manifests[].platform' +{ + "architecture": "386", + "os": "linux" +} { "architecture": "amd64", "os": "linux" } { "architecture": "arm", - "os": "linux" + "os": "linux", + "variant": "v6" +} +{ + "architecture": "arm", + "os": "linux", + "variant": "v7" } { "architecture": "arm64", @@ -43,6 +54,10 @@ $ crane manifest gcr.io/imjasonh/combined | jq '.manifests[].platform' "architecture": "ppc64le", "os": "linux" } +{ + "architecture": "riscv64", + "os": "linux" +} { "architecture": "s390x", "os": "linux" @@ -50,16 +65,16 @@ $ crane manifest gcr.io/imjasonh/combined | jq '.manifests[].platform' { "architecture": "amd64", "os": "windows", - "os.version": "10.0.17763.1935" + "os.version": "10.0.20348.887" } { - "architecture": "arm", + "architecture": "amd64", "os": "windows", - "os.version": "10.0.17763.1935" + "os.version": "10.0.17763.3287" } ``` -The result is an image that provides support for both. -If both manifest lists provide support for the same platform, the script will fail. +The result is an image that provides support for all the provided base image platforms. +If any manifest lists provide duplicate support for the same platform, the script will fail. This image is intended to be suitable as a base image used with `ko` to provide multi-arch _and multi-OS_ support for a Go application. diff --git a/vendor/github.com/tektoncd/plumbing/cmd/combine/main.go b/vendor/github.com/tektoncd/plumbing/cmd/combine/main.go index b2ac23fe761..701f00d752d 100644 --- a/vendor/github.com/tektoncd/plumbing/cmd/combine/main.go +++ b/vendor/github.com/tektoncd/plumbing/cmd/combine/main.go @@ -32,12 +32,14 @@ import ( ) func main() { - if len(os.Args) != 4 { - log.Fatal("expected exactly 3 args (src1, src2, dst)") + if len(os.Args) < 4 { + log.Fatal("expected at least 3 args (src1, src2, ... dst)") } - src1, src2, dst := os.Args[1], os.Args[2], os.Args[3] - log.Println("combining", src1, src2, "into", dst) + srcs := os.Args[1 : len(os.Args)-1] + dst := os.Args[len(os.Args)-1] + + log.Println("combining", srcs, "into", dst) dstr, err := name.ParseReference(dst) if err != nil { log.Fatal(err) @@ -50,14 +52,6 @@ func main() { } return remote.Index(r) } - src1i, err := pull(src1) - if err != nil { - log.Fatalf("pulling %q: %v", src1, err) - } - src2i, err := pull(src2) - if err != nil { - log.Fatalf("pulling %q: %v", src2, err) - } plats := map[string]bool{} var adds []mutate.IndexAddendum @@ -70,7 +64,6 @@ func main() { if desc.Platform == nil { return fmt.Errorf("found nil platform for manifest %s", desc.Digest) } - b, err := json.Marshal(desc.Platform) if err != nil { return fmt.Errorf("marshalling platform: %w", err) @@ -92,13 +85,16 @@ func main() { } return nil } - log.Println("---", src1, "---") - if err := add(src1i); err != nil { - log.Fatalf("adding manifests from src1: %v", err) - } - log.Println("---", src2, "---") - if err := add(src2i); err != nil { - log.Fatalf("adding manifests from src2: %v", err) + + for _, src := range srcs { + log.Println("---", src, "---") + srci, err := pull(src) + if err != nil { + log.Fatalf("pulling %q: %v", src, err) + } + if err := add(srci); err != nil { + log.Fatalf("adding manifests from src %q: %v", src, err) + } } dsti := mutate.AppendManifests(mutate.IndexMediaType(empty.Index, types.DockerManifestList), adds...) diff --git a/vendor/modules.txt b/vendor/modules.txt index 87abeab4d30..f196fac8ed8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -447,7 +447,7 @@ github.com/spf13/pflag ## explicit; go 1.13 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/tektoncd/plumbing v0.0.0-20220728121531-8a725746af4f +# github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb ## explicit; go 1.13 github.com/tektoncd/plumbing github.com/tektoncd/plumbing/cmd/combine