Commit Graph

12 Commits

Author SHA1 Message Date
Miloslav Trmač 08f2e05f41 Consistently close ImageSource objects
That's a real leak in the OptimizeDestinationImageAlreadyExists case,
plus several instances in test code.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-06-29 20:31:51 +02:00
Miloslav Trmač f6babe954a Use strings.ReplaceAll instead of strings.Replace(..., -1)
... for a trivial improvement in readability.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-06-21 20:51:01 +02:00
Giuseppe Scrivano 857a813795
docker: add workaround for CloudFront
CloudFront returns an unquoted ':' in the boundary, special handle it.
It is needed for partial pulls from quay.io.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-11 21:11:23 +02:00
Miloslav Trmač 7152f888b9 Update users of deprecated io/ioutil
Mostly just name changes that should not change behavior,
apart from ioutil.ReadDir -> os.ReadDir avoiding per-item
lstat(2) in some cases.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-04-13 20:46:48 +02:00
Miloslav Trmač f8c38d073e Add private.ImageSource and internal/imagesource.FromPublic
Following the now-established pattern, introduce private.ImageSource
(with a new SupportsGetBlobAt() method), implement it in
dockerImageSource, and use a wrapped version in c/image/copy.

This gives us private.ImageSource and private.ImageDestination,
to allow for future features.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-12 03:28:54 +01:00
Miloslav Trmač 1c2b3fa71d Rename private.ImageSourceSeekable to BlobChunkAccessor
The way we actually use this, injecting a progress-reporting
proxy, the PutBlobPartial method doesn't have access to the
full ImageSource; so, differentiate more clearly between
this small interface and an ImageSource.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-12 03:27:56 +01:00
Miloslav Trmač ac00ae7bfc Add interface conformance assertions for the private interfaces
... to ensure we don't break anything by refactoring.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-11 10:41:19 +01:00
Miloslav Trmač 98f24f0af0 Rename internal/types/types.go to internal/private/private.go
The goal is to establish a practical/convenient naming for
internal-only interfaces, now that we are going to start using them
much more frequently.

Design concerns:
- Don't duplicate any public package name (to avoid the
  publicTypes/internalTypes names in every single user).
  Rules out "types", "image" (as in "image.Destination").
- Don't just use "internal", to keep that around for
  very localized private utilities, like oci/internal

"private", as a more or less synonym to "internal", seems
to work acceptably well: we will have types.ImageDestination
and private.ImageDestination.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-11 10:17:34 +01:00
Giuseppe Scrivano ea19c43cf0
docker: convert fully body to partial requests
ghcr.io converts a multirange request to a 200 response when the
client request too much data.

If the server replies with a 200 status to a partial request then
split the body ignoring any additional content that wasn't requested
by the caller.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-25 21:38:03 +02:00
Josh Soref 111bf164be Spelling
* about
* appropriate
* busybox
* candidate
* candidates
* certificate
* config
* configuration
* containers
* decompression
* directory
* does-not/match
* does/not/exist
* doesnot
* doesnotexist
* exemplary
* garbage
* gzipped
* identify
* initially
* kubernetes
* length
* marshaling
* maximum
* mybetaproduct
* overridden
* parameter
* permissive
* policyconfiguration
* protocols
* reference
* referenceable
* requirement
* response
* simultaneously
* slashes
* subobject
* successfully
* this
* uncompressed
* unmarshaled
* unmarshaler
* unmarshaling it
* unmarshaller
* valid

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-23 14:37:37 -04:00
Miloslav Trmač d52a99c532 Don't change dockerImageSource.Reference() if a mirror is used
... because that value is used for signature verification.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-05-04 16:37:06 +02:00
Miloslav Trmač 6ba11af89b Strip MIME type parameters from Content-Type
OpenShift returns "application/json; charset=utf-8"; with greatest
respect to the strict need to care about character encoding, we don't
want to get into the business of implementing support for charset
encoding, so just drop that on the floor.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-06-28 19:57:46 +02:00