mirror of
https://github.com/containers/image.git
synced 2025-04-18 19:44:05 +03:00
commit
7f104cd097
16
.cirrus.yml
16
.cirrus.yml
@ -6,9 +6,9 @@ env:
|
||||
#### Global variables used for all tasks
|
||||
####
|
||||
# Name of the ultimate destination branch for this CI run
|
||||
DEST_BRANCH: "main"
|
||||
DEST_BRANCH: "release-5.22"
|
||||
# CI container image tag (c/skopeo branch name)
|
||||
SKOPEO_CI_TAG: "main"
|
||||
SKOPEO_CI_TAG: "release-1.9"
|
||||
# Use GO module mirror (reason unknown, travis did it this way)
|
||||
GOPROXY: https://proxy.golang.org
|
||||
# Overrides default location (/tmp/cirrus) for repo clone
|
||||
@ -33,18 +33,13 @@ env:
|
||||
#### Cache-image names to test with (double-quotes around names are critical)
|
||||
####
|
||||
FEDORA_NAME: "fedora-36"
|
||||
PRIOR_FEDORA_NAME: "fedora-35"
|
||||
UBUNTU_NAME: "ubuntu-2204"
|
||||
|
||||
# Google-cloud VM Images
|
||||
IMAGE_SUFFIX: "c6340043416535040"
|
||||
IMAGE_SUFFIX: "c5495735033528320"
|
||||
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
|
||||
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
|
||||
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-${IMAGE_SUFFIX}"
|
||||
|
||||
# Container FQIN's (include bleeding-edge development-level container deps.)
|
||||
FEDORA_CONTAINER_FQIN: "quay.io/libpod/fedora_podman:${IMAGE_SUFFIX}"
|
||||
PRIOR_FEDORA_CONTAINER_FQIN: "quay.io/libpod/prior-fedora_podman:${IMAGE_SUFFIX}"
|
||||
UBUNTU_CONTAINER_FQIN: "quay.io/libpod/ubuntu_podman:${IMAGE_SUFFIX}"
|
||||
# Built along with the standard PR-based workflow in c/automation_images
|
||||
SKOPEO_CIDEV_CONTAINER_FQIN: "quay.io/libpod/skopeo_cidev:${IMAGE_SUFFIX}"
|
||||
@ -156,10 +151,7 @@ meta_task:
|
||||
image: quay.io/libpod/imgts:$IMAGE_SUFFIX
|
||||
env:
|
||||
# Space-separated list of images used by this repository state
|
||||
IMGNAMES: >-
|
||||
${FEDORA_CACHE_IMAGE_NAME}
|
||||
${PRIOR_FEDORA_CACHE_IMAGE_NAME}
|
||||
${UBUNTU_CACHE_IMAGE_NAME}
|
||||
IMGNAMES: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
BUILDID: "${CIRRUS_BUILD_ID}"
|
||||
REPOREF: "${CIRRUS_REPO_NAME}"
|
||||
GCPJSON: ENCRYPTED[04306103eee1933f87deb8a5af6514a7e3164aa589d6079abc0451eb2360879430ed020d6e025ca64ef667138ce9d786]
|
||||
|
2
Makefile
2
Makefile
@ -55,7 +55,7 @@ tools: .install.gitvalidation .install.golangci-lint .install.golint
|
||||
|
||||
.install.golangci-lint:
|
||||
if [ ! -x "$(GOBIN)/golangci-lint" ]; then \
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v1.44.2; \
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v1.47.2; \
|
||||
fi
|
||||
|
||||
.install.golint:
|
||||
|
@ -1,6 +1,7 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
@ -921,15 +922,25 @@ func (c *dockerClient) getOCIDescriptorContents(ctx context.Context, ref dockerR
|
||||
// isManifestUnknownError returns true iff err from fetchManifest is a “manifest unknown” error.
|
||||
func isManifestUnknownError(err error) bool {
|
||||
var errs errcode.Errors
|
||||
if !errors.As(err, &errs) || len(errs) == 0 {
|
||||
return false
|
||||
if errors.As(err, &errs) && len(errs) != 0 {
|
||||
firstErr := errs[0]
|
||||
// docker/distribution, and as defined in the spec
|
||||
var ec errcode.ErrorCoder
|
||||
if errors.As(firstErr, &ec) && ec.ErrorCode() == v2.ErrorCodeManifestUnknown {
|
||||
return true
|
||||
}
|
||||
// registry.redhat.io as of October 2022
|
||||
var e errcode.Error
|
||||
if errors.As(firstErr, &e) && e.ErrorCode() == errcode.ErrorCodeUnknown && e.Message == "Not Found" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
err = errs[0]
|
||||
ec, ok := err.(errcode.ErrorCoder)
|
||||
if !ok {
|
||||
return false
|
||||
// ALSO registry.redhat.io as of October 2022
|
||||
var unexpected *clientLib.UnexpectedHTTPResponseError
|
||||
if errors.As(err, &unexpected) && unexpected.StatusCode == http.StatusNotFound && bytes.Contains(unexpected.Response, []byte("Not found")) {
|
||||
return true
|
||||
}
|
||||
return ec.ErrorCode() == v2.ErrorCodeManifestUnknown
|
||||
return false
|
||||
}
|
||||
|
||||
// getSigstoreAttachmentManifest loads and parses the manifest for sigstore attachments for
|
||||
|
@ -1,6 +1,8 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -187,3 +189,59 @@ func TestUserAgent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsManifestUnknownError(t *testing.T) {
|
||||
// Mostly a smoke test; we can add more registries here if they need special handling.
|
||||
|
||||
for _, c := range []struct{ name, response string }{
|
||||
{
|
||||
name: "docker.io when a tag in an _existing repo_ is not found",
|
||||
response: "HTTP/1.1 404 Not Found\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"Content-Length: 109\r\n" +
|
||||
"Content-Type: application/json\r\n" +
|
||||
"Date: Thu, 12 Aug 2021 20:51:32 GMT\r\n" +
|
||||
"Docker-Distribution-Api-Version: registry/2.0\r\n" +
|
||||
"Ratelimit-Limit: 100;w=21600\r\n" +
|
||||
"Ratelimit-Remaining: 100;w=21600\r\n" +
|
||||
"Strict-Transport-Security: max-age=31536000\r\n" +
|
||||
"\r\n" +
|
||||
"{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest unknown\",\"detail\":{\"Tag\":\"this-does-not-exist\"}}]}\n",
|
||||
},
|
||||
{
|
||||
name: "registry.redhat.io/v2/this-does-not-exist/manifests/latest",
|
||||
response: "HTTP/1.1 404 Not Found\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"Content-Length: 53\r\n" +
|
||||
"Cache-Control: max-age=0, no-cache, no-store\r\n" +
|
||||
"Content-Type: application/json\r\n" +
|
||||
"Date: Thu, 13 Oct 2022 18:15:15 GMT\r\n" +
|
||||
"Expires: Thu, 13 Oct 2022 18:15:15 GMT\r\n" +
|
||||
"Pragma: no-cache\r\n" +
|
||||
"Server: Apache\r\n" +
|
||||
"Strict-Transport-Security: max-age=63072000; includeSubdomains; preload\r\n" +
|
||||
"X-Hostname: crane-tbr06.cran-001.prod.iad2.dc.redhat.com\r\n" +
|
||||
"\r\n" +
|
||||
"{\"errors\": [{\"code\": \"404\", \"message\": \"Not Found\"}]}\r\n",
|
||||
},
|
||||
{
|
||||
name: "registry.redhat.io/v2/rhosp15-rhel8/openstack-cron/manifests/sha256-8df5e60c42668706ac108b59c559b9187fa2de7e4e262e2967e3e9da35d5a8d7.sig",
|
||||
response: "HTTP/1.1 404 Not Found\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"Content-Length: 10\r\n" +
|
||||
"Accept-Ranges: bytes\r\n" +
|
||||
"Date: Thu, 13 Oct 2022 18:13:53 GMT\r\n" +
|
||||
"Server: AkamaiNetStorage\r\n" +
|
||||
"X-Docker-Size: -1\r\n" +
|
||||
"\r\n" +
|
||||
"Not found\r\n",
|
||||
},
|
||||
} {
|
||||
resp, err := http.ReadResponse(bufio.NewReader(bytes.NewReader([]byte(c.response))), nil)
|
||||
require.NoError(t, err, c.name)
|
||||
err = fmt.Errorf("wrapped: %w", registryHTTPResponseToError(resp))
|
||||
|
||||
res := isManifestUnknownError(err)
|
||||
assert.True(t, res, "%#v", err, c.name)
|
||||
}
|
||||
}
|
||||
|
@ -652,6 +652,7 @@ func (d *dockerImageDestination) putSignaturesToSigstoreAttachments(ctx context.
|
||||
Digest: "", // We will fill this in later.
|
||||
Size: 0,
|
||||
}, nil)
|
||||
ociConfig.RootFS.Type = "layers"
|
||||
} else {
|
||||
logrus.Debugf("Fetching sigstore attachment config %s", ociManifest.Config.Digest.String())
|
||||
// We don’t benefit from a real BlobInfoCache here because we never try to reuse/mount configs.
|
||||
|
@ -54,7 +54,8 @@ func registryHTTPResponseToError(res *http.Response) error {
|
||||
if len(response) > 50 {
|
||||
response = response[:50] + "..."
|
||||
}
|
||||
err = fmt.Errorf("StatusCode: %d, %s", e.StatusCode, response)
|
||||
// %.0w makes e visible to error.Unwrap() without including any text
|
||||
err = fmt.Errorf("StatusCode: %d, %s%.0w", e.StatusCode, response, e)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const (
|
||||
// VersionMinor is for functionality in a backwards-compatible manner
|
||||
VersionMinor = 22
|
||||
// VersionPatch is for backwards-compatible bug fixes
|
||||
VersionPatch = 1
|
||||
VersionPatch = 2
|
||||
|
||||
// VersionDev indicates development branch. Releases will be empty string.
|
||||
VersionDev = "-dev"
|
||||
|
Loading…
x
Reference in New Issue
Block a user