Working with strings is error-prone because a platform
can be in multiple string forms and less flexible.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This adds a couple more integration tests to more fully define the
behavior of these interactions. Additionally, through this, a minor
difference to POSIX was discovered where quotes are supposed to be
properly preserved in a heredoc (since a heredoc is treated as a
double-quoted word).
To handle this, a new property, SkipProcessQuotes is added to the shell
lexer which simply treats quotes as ordinary characters. This is the
only behavioral change needed to actually get the new tests working.
Signed-off-by: Justin Chadwell <me@jedevc.com>
In the contents of COPY/ADD, we perform expansion on variables using a
lexer. However, this lexer, by default, removes quotes as well as
expanding variables - this isn't really the kind of behavior we're
after, as it feels quite unintuitive.
To fix this, we introduce a new ExpandRaw function, which commands can
implement that implement an alternative expansion that preserves quotes
(and possibly other characters/features in the future).
Additionally, we introduce new tests to more clearly define the desired
behavior. One major note is that backslashes are not passed directly,
and are processed, following normal escape rules (so that we can use `$`
symbols directly).
Signed-off-by: Justin Chadwell <me@jedevc.com>
Previously, we'd only write raw escapes out as words, and not out to the
result. We weren't using or relying on this behaviour, but it could
easily have caused a bug if we were. This patch just cleans rawEscapes
to behave like rawQuotes.
Signed-off-by: Justin Chadwell <me@jedevc.com>
This fixes errors such as:
error: cannot update ref 'refs/heads/v2.30.0': trying to write non-commit object 2d9685d47a7e516281aa093bf0cddc8aafa72448 to branch 'refs/heads/v2.30.0'
which occur when cloning a tag rather than branch.
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
open-telemetry/opentelemetry-specification#740 has decided to
promote different set of env for CLI propagation.
Switch to use them so we are more consistent with other
tools. Old ones should be removed in a future release.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Before this change, the lower and upper parents provided to the cache
manager Diff method were not cloned, which resulted in some code paths
incorrectly providing them directly as the parents of the returned ref.
This meant that if they were released after the call to Diff, the diff
ref could become incorrectly invalidated.
Now, the lower and upper are cloned and unit test coverage has been
added to test that ref release is handled correctly.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Instead of doing a direct string comparison we should
use `platforms.Only` so that we can also detect the
variants that are compatible but don’t match directly.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Before this, there could be crash during a call to finalize a ref that
occured after the snapshot was committed but before committing the
metadata that indicates the immutable ref no longer had an
equalMutable. This resulted in a situation where any future calls to
finalize that ref would fail.
Now, if that situation happens, the cache will notice when it's
initially loaded that the ref has an equalMutable that's missing its
snapshot and that its own snapshot exists. It will then just use the
correctly committed snapshot and clear the equalMutable field.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
This adds test coverage for ensuring the readonly parameter is honored
as expected in the ref Mount methods. There was a regression introduced
during #2335 that went unnoticed until identified and fixed in #2562.
This test coverage should help prevent similar regressions in the
future.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
This change enables inline cache to work as expected with MergeOp by
supporting a new type of result, DiffResult, which enables results to be
specified as a specific ordered set of layers inside an image.
Previously, results could only be specified with a singe layer index,
which meant that they had to start at the image's base layer and end at
that index. That meant that merge inputs couldn't be specified as they
are often a subset of the image layers that don't begin at the base.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>