- Diferentiate partial pull errors from other read errors
- Indicate that this is PrepareStagedLayer that is failing
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
define a new error type so that the caller can determine whether it is
safe to ignore the error and retrieve the resource fully.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
I think this is just visually noisy. If we didn't do a partial
fetch then let's just not say anything about it.
Signed-off-by: Colin Walters <walters@verbum.org>
Consolidate the [duplicated] code that handles and wraps the errors from
Close to a function, and call it twice.
Keep the code which deliberately converts an error from Close to a
string (rather than wrapping it) as we don't want those errors to be
unwrappable (those are not "primary" errors).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Add a CompressionAnnotations field
- Allow turning a known-zstd blob into a zstd:chunked one if we
know the right annotations
This just adds the fields, nothing sets them yet, should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Introduce distinct uploadedCompressorBaseVariantName and
uploadedCompressorSpecificVariantName fields; that way we now never
call RecordDigestCompressorData with inconsistent zstd / zstd:chunked in one field,
so we can always record data when we see, or create, a zstd:chunked layer,
removing the current hack.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
The cache implementations are recording both the base and specific compression variant;
CandidateLocations2 all call CandidateTemplateWithCompression to choose the
appropriate variants to return based on CandidateLocations2Options.
This way, neither the BIC implementations nor the transports are not responsible for
converting zstd:chunked entries to zstd entries if the user wants the latter.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... because we don't trust the TOC data, if any.
This allows us to remove the zstd:chunked hack; we, at least,
now record those blobs as zstd.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We will want to record more than a single alghoritm name. For now,
just introduce the structure and modify users, we'll add the new fields
later.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Current .codespellrc contains too many exclusions, and as a result it
misses some legitimate typos.
A few previous commits silenced or fixed some of the codespell warnings
in preparation for this one, which minimizes exclusions, and fixes the
actual remaining typos.
The fixes here are the result of codespell -w.
./copy/sign_test.go:119: overidden ==> overridden
./copy/encryption.go:51: pratice ==> practice
./copy/multiple_test.go:80: crated ==> created
./copy/progress_bars.go:124: progres ==> progress
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This fixes a comment in the test code ("expection", "out", and
punctuation) to the best of my knowledge.
Fixes: c84a3fad ("copy/multiple_test: multiple copy requests of same compression")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
They are set on all code paths creating bpCompressionStepData.
Just to be sure, check and fail instead of just removing the check.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Otherwise "err" refers to a variable outside of this closure,
not even to the one used by the immediate caller.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
The compiler is smart enough that referencing
a local variable is not any faster than len(srcInfos).
If anything, keeping the extra variable might add to register pressure
because the compiler might not understand that the srcInfos change due to
LayerInfosForCopy does not change the number of layers.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
if the specified length for the range is set to -1, then request all
the data possible by using the "Range: <unit>=<range-start>-" syntax
for the HTTP range.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Typically, use %q instead of %s (or instead of "%s"), to expose
various control characters and the like without interpreting them.
This is not really comprehensive; the codebase makes no _general_
guarantee that any returned string values are free of control
characters or other malicious/misleading metadata. Not even
in returned "error" values (which can legitimately contain newlines,
if nothing else).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... to prevent panics if the value does not contain a :, or other unexpected
values (e.g. a path traversal).
Don't bother on paths where we computed the digest ourselves, or it is already trusted
for other reasons.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This should not matter much in practice - CompressionAlgorithm
is only used for updating MIME types, and for ListEdit.*CompressionAlgorithms,
where zstd and zstd:chunked are treated the same - but it's easier to
make the logic accurate than to commit to the fields _only_
carrying BaseVariantName-values.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
e.g. when the user asks for zstd, also accept zstd:chunked.
This does not currently make a difference because we can't detect
zstd:chunked in blobPipelineDetectCompressionStep, and the
BlobInfoCache does not record zstd:chunked; but let's get the logic
more correct.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
The reason is hidden if `expectedDigest.Validate()` errors. This patch
will add the error message to the stack to provide more details.
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Add fields to manifest.ListUpdate for setting the ArtifactType field in
an entry being added to a list. When copying a list or descriptor,
preserve the value from the original descriptor for an entry.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
The caller must already have provided options.TOCDigest, so
we don't really need to return a value; the UI only needs
a boolean.
Also, document, again, that the non-TOC digest is a mandatory field.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... because it is always available, and this allows us to remove
a condition.
Also rename it to LayerIndex, and make the Cache option first,
for consistency with other private.*Options types.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This will allow us to name the more obscure parameters,
and to change their names/semantics without having to update
the 4 trivial implementations.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This update introduces an enhancement in the blob handling mechanism,
specifically by separating the TOC digest from the
uncompressed/compressed digest.
Follow-up for: #1080.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>