Commit Graph

31 Commits

Author SHA1 Message Date
Adam Eijdenberg 9b41f3c9b5 feat: use HistoryTimestamp, if set, for oci-archive entries
Signed-off-by: Adam Eijdenberg <adam@continusec.com>
2025-03-25 07:14:04 +00:00
Nalin Dahyabhai 662abee0bf Commit(): retry committing to local storage on storage.LayerUnknown
If we get a storage.LayerUnknown error while committing to local
storage, guess that we tried to reuse a layer in an image that got
deleted in the brief window between when the commit logic decided that
it could reuse the layer, and when it actually tried to create the image
record.

It's tempting to try to resolve this in the image library, but at the
point where this error crops up, it may already have skipped pulling the
relevant layer blob, so the entire copy operation would have to be
restarted from the beginning anyway, and that's the retry package's job.

It's tempting to bake this into the common library's retry package, but
that would require it to "know" about containers/storage, and while in
practice most of its callers already depend on the storage library, that
may a bit much.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-15 13:26:30 -04:00
Nalin Dahyabhai 5f18ba259a AddAndCopyOptions: add CertPath, InsecureSkipTLSVerify, Retry fields
Add CertPath and InsecureSkipTLSVerify flags to AddAndCopyOptions, and
connect the CLI flag values passed to `buildah add` and `buildah build`
so that Builder.Add() gets those.

Add MaxRetries and RetryDelay fields to AddAndCopyOptions, and connect
them to the values passed on the command line to `buildah add` and
`buildah build`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-07-25 17:39:08 -04:00
Giuseppe Scrivano 7053383792
buildah: use fileutils.(Le|E)xists
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-04-12 09:58:14 +02:00
Daniel J Walsh 4704e6cb3f
Eliminate the use of containers/building import in pkg subdirs
We want to shrink the size of the import when importing pkg from
buildah. This should help us shrink the size of the golang bindings
in podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-12 12:43:08 -05:00
Nalin Dahyabhai 6a1f29e343 Stop overriding the location of the blob info cache
When it was first introduced, the blob info cache's location didn't
change from the system-wide default location when we were running in
rootless mode, so we started setting its location ourselves to avoid
triggering permissions errors when updating it.

The image library has since started taking into account that it was
running in rootless mode, but its hardwired default isn't the same as
the one we were setting, so we ended up creating a second cache file.

Stop doing that.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-01-12 10:26:21 -05:00
Nalin Dahyabhai ad7cfc3e9b Heed our retry delay option values when retrying commit/pull/push
Pass our own API values for retry delays to common's retry package when
we use it to handle retrying image pull/commit/push operations.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-08-28 15:20:28 -04:00
Qi Wang cea59d97c9 Replace retry functions with common/pkg/retry
Use retry pacakge from containers/common and change the retryDelay to exponential backoff from there.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-08-13 15:28:56 -04:00
Brandon Lum 37df2b9690 implementation of encrypt/decrypt push/pull/bud/from
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-05-18 21:27:23 +00:00
Daniel J Walsh b2e7110255
vendor in latest containers/storage 1.18.0 and containers/common v0.7.0
This vendor moves containers/common/pkg/unshare to containers/storage/pkg/unshare

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-31 09:56:18 -04:00
Daniel J Walsh 6d798e84fc
Replace unix with syscall to allow vendoring into libpod
unix constants do not work when vendored into libpod, because
libpod can potentially be used on non unix platforms, so
compilation blows up.  Switching to syscall should fix this issue.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-23 06:25:02 -05:00
Nalin Dahyabhai b72bda2dff pull/from/commit/push: retry on most failures
If PullOptions/BuilderOptions/CommitOptions/PushOptions includes a
MaxRetries value other than 0, retry operations except for (currently)
connection-refused, authentication, and no-such-repository/no-such-tag
errors, at a default-but-configurable interval of 5 seconds.

Set the default for `buildah pull/from/commit/push` to 3 retries at 2
second intervals.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-02-10 14:07:10 -05:00
Nalin Dahyabhai a925f79cc3 add --sign-by to bud/commit/push, --remove-signatures for pull/push
Add the --sign-by option to `buildah build-using-dockerfile`,
`buildah commit`, `buildah push`, and `buildah manifest push`.  Add the
`--remove-signatures` option to `buildah pull`, `buildah push`, and
`buildah manifest push`.  We just pass them to the image library, which
does all of the heavy lifting.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #2085
Approved by: rhatdan
2020-01-17 18:22:34 +00:00
Daniel J Walsh 8fc5b0116f Start using containers/common
We have moved share code from buildah, podman and others into containers/common.

Specifically for this PR we are moving to use containers/common/pkg/unshare and
containers/common/pkg/cgroups.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #2010
Approved by: QiWang19
2019-12-06 14:37:27 +00:00
Nalin Dahyabhai f0cf07bb60 Move to containers/image v5.0.0
Bump to containers/image's 5.0 release.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #1902
Approved by: rhatdan
2019-10-28 15:15:34 +00:00
Miloslav Trmač 797e618cbe Update c/image to v4.0.1
This requires updating all import paths throughout.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1891
Approved by: vrothberg
2019-10-04 07:34:03 +00:00
Sascha Grunert 16e301031e Add unparam linter and apply fixes
This commit enabled the `unparam` linter and applies all reported issues.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>

Closes: #1719
Approved by: rhatdan
2019-07-16 21:21:32 +00:00
Giuseppe Scrivano ac66d785d4 unshare: move to pkg/
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1475
Approved by: rhatdan
2019-04-05 03:04:46 +00:00
Daniel J Walsh 3d74031301 Move pkg/chrootuser from libpod to buildah.
We don't want to vendor anything from libpod into Buildah.
We want to switch this around.  Moving pkg content from libpod
to Buildah allows us to fix this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1400
Approved by: giuseppe
2019-03-26 15:45:33 +00:00
Daniel J Walsh 939de6f4d9 Allow rootless users to use the cache directory in homedir
Currently rootless podman attempts to write to /var/lib/containers/cache
and fails. This causes us to repeatedly push images that have already been
pushed.  This cache directory should be relative to the location of containers/storage
and not always stored in the same directory.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1411
Approved by: TomSweeneyRedHat
2019-03-14 14:25:09 +00:00
Miloslav Trmač eb17c3364e Do not set OCIInsecureSkipTLSVerify based on registries.conf
- OCIInsecureSkipTLSVerify applies only to c/image/layout.Transport and
  c/image/archive.Transport; in both, ImageTransport.DockerReference
  always returns nil, which causes isReferenceSomething, and therefore
  isRegistryInsecure, to always return false; i.e., this code
  was never executed for those transports for which it could make a difference.

- The oci: and oci-archive: transports refer to local filesystems, so matching that
  against docker/distribution hostnames does not really make sense.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1255
Approved by: rhatdan
2019-01-06 14:53:06 +00:00
Miloslav Trmač 9c65e5699c Update for sysregistriesv2 API changes
Mostly this is a straightforward elimination of manual GetRegistries calls.

In getCopyOptions, we just remove setting the DockerInsecureSkipTLSVerify
values because the docker:// tranport now does that automatically.  (This
actually changes behavior, because docker:// supports namespace prefixes
in addition to matching only by hostnames, but that's a superset of the
previous behavior.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1214
Approved by: rhatdan
2018-12-03 20:07:00 +00:00
Giuseppe Scrivano c116133dd5 common: support a per-user registries conf file
Closes: #1124
Approved by: rhatdan
2018-10-24 15:30:14 +00:00
Nalin Dahyabhai 62c01da3e4 Correctly set DockerInsecureSkipTLSVerify when pulling images
The image library's copy routine doesn't itself consult the registries
configuration in order to decide whether or not to disable TLS
verification when communicating with a registry, so it's on us to use
the name of a source or destination image to decide whether to set the
flag for that behavior.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #1056
Approved by: rhatdan
2018-10-05 15:30:11 +00:00
Daniel J Walsh 46c58b2919 Document BUILDAH_* environment variables in buildah bud --help output
We also want to show the default settings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #956
Approved by: rhatdan
2018-08-24 18:50:16 +00:00
Nalin Dahyabhai 47ac96155f Use configured registries to resolve image names
When locating an image for pulling, inspection, or pushing, if we're
given an image name that doesn't include a domain/registry, try building
a set of candidate names using the configured registries as domains, and
then pull/inspect/push using the first of those names that works.

If a name that we're given corresponds to a prefix of the ID of a local
image, skip completion and use the ID directly instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #360
Approved by: rhatdan
2017-12-14 22:21:16 +00:00
Urvashi Mohnani 4419612150 Add manifest type conversion to buildah push
buildah push supports manifest type conversion when pushing using the 'dir' transport
Manifest types include oci, v2s1, and v2s2
e.g buildah push --format v2s2 alpine dir:my-directory

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>

Closes: #321
Approved by: rhatdan
2017-11-15 13:38:28 +00:00
TomSweeneyRedHat 498f0ae9d7 Add credentials to buildah from
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Add credentials to buildah from

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #204
Approved by: nalind
2017-08-22 18:55:38 +00:00
Dan Walsh 33c2a8a418 gccgo is giving errors about using copy
golang-bin-1.8.1-1.fc26.x86_64
gcc-go-7.1.1-1.fc26.x86_64

Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #135
Approved by: nalind
2017-06-06 19:40:56 +00:00
Nalin Dahyabhai 12e582ee1a Report pull/commit progress by default
Have 'from', 'commit', and 'build-using-dockerfile' report progress via
stderr (so that capturing output from 'from' and 'commit' still works as
expected) unless --quiet is used to suppress the reporting.

Closes #94.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #98
Approved by: rhatdan
2017-05-10 12:53:25 +00:00
Nalin Dahyabhai 0ab0890e4e Massive refactoring
Pull most of the core logic from the CLI into a package that should be
easier to consume as a library.  Add a "config" command that updates the
builder object's configuration.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-10 11:48:15 -05:00