Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use retry logic from containers/common #5345

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DEBIAN_NAME: "debian-13"

# Image identifiers
IMAGE_SUFFIX: "c20240201t143038z-f39f38d13"
IMAGE_SUFFIX: "c20240222t143004z-f39f38d13"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
DEBIAN_CACHE_IMAGE_NAME: "debian-${IMAGE_SUFFIX}"
Expand Down Expand Up @@ -153,7 +153,7 @@
path: ./bin/*


unit_task:

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: 'Unit tests w/ $STORAGE_DRIVER'
alias: unit
only_if: &not_build_docs >-
Expand All @@ -180,7 +180,7 @@
path: ./bin/*


conformance_task:

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: 'Build Conformance w/ $STORAGE_DRIVER'
alias: conformance
only_if: *not_build_docs
Expand All @@ -201,7 +201,7 @@
conformance_test_script: '${SCRIPT_BASE}/test.sh conformance |& ${_TIMESTAMP}'


integration_task:

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: "Integration $DISTRO_NV w/ $STORAGE_DRIVER"
alias: integration
only_if: *not_build_docs
Expand All @@ -221,6 +221,7 @@
DISTRO_NV: "${DEBIAN_NAME}"
IMAGE_NAME: "${DEBIAN_CACHE_IMAGE_NAME}"
STORAGE_DRIVER: 'vfs'
CI_DESIRED_RUNTIME: runc
# OVERLAY
- env:
DISTRO_NV: "${FEDORA_NAME}"
Expand All @@ -234,6 +235,7 @@
DISTRO_NV: "${DEBIAN_NAME}"
IMAGE_NAME: "${DEBIAN_CACHE_IMAGE_NAME}"
STORAGE_DRIVER: 'overlay'
CI_DESIRED_RUNTIME: runc
TomSweeneyRedHat marked this conversation as resolved.
Show resolved Hide resolved

gce_instance:
image_name: "$IMAGE_NAME"
Expand All @@ -256,7 +258,7 @@
package_versions_script: '$GOSRC/$SCRIPT_BASE/logcollector.sh packages'
golang_version_script: '$GOSRC/$SCRIPT_BASE/logcollector.sh golang'

integration_rootless_task:

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 261 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L261

task "Integration rootless debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: "Integration rootless $DISTRO_NV w/ $STORAGE_DRIVER"
alias: integration_rootless
only_if: *not_build_docs
Expand Down Expand Up @@ -295,7 +297,7 @@
always:
<<: *standardlogs

in_podman_task:

Check warning on line 300 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L300

task "Containerized Integration" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 300 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L300

task "Containerized Integration" depends on task "Cross Compile", but their only_if conditions are different
name: "Containerized Integration"
alias: in_podman
only_if: *not_build_docs
Expand All @@ -322,7 +324,7 @@
# Status aggregator for all tests. This task simply ensures a defined
# set of tasks all passed, and allows confirming that based on the status
# of this task.
success_task:

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Unit tests w/ vfs", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Unit tests w/ overlay", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Build Conformance w/ vfs", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Build Conformance w/ overlay", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration fedora-39 w/ vfs", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration fedora-38 w/ vfs", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration debian-13 w/ vfs", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration fedora-39 w/ overlay", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration fedora-38 w/ overlay", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Integration debian-13 w/ overlay", but their only_if conditions are different

Check warning on line 327 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L327

task "Total Success" depends on task "Containerized Integration", but their only_if conditions are different
# N/B: The prow merge-bot (tide) is sensitized to this exact name, DO NOT CHANGE IT.
# Ref: https://github.com/openshift/release/pull/48909
name: "Total Success"
Expand Down
12 changes: 6 additions & 6 deletions cmd/buildah/addcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,20 @@ func addAndCopyCmd(c *cobra.Command, args []string, verb string, iopts addCopyRe
if err2 != nil {
return fmt.Errorf("unable to obtain decrypt config: %w", err2)
}
var pullPushRetryDelay time.Duration
pullPushRetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
options := buildah.BuilderOptions{
FromImage: iopts.from,
BlobDirectory: iopts.blobCache,
SignaturePolicyPath: iopts.signaturePolicy,
SystemContext: systemContext,
MaxPullRetries: iopts.retry,
PullRetryDelay: pullPushRetryDelay,
OciDecryptConfig: decryptConfig,
}
if iopts.retryDelay != "" {
options.PullRetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
}
if !iopts.quiet {
options.ReportWriter = os.Stderr
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/buildah/from.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,6 @@ func fromCmd(c *cobra.Command, args []string, iopts fromReply) error {
return fmt.Errorf("unable to obtain decrypt config: %w", err)
}

var pullPushRetryDelay time.Duration
pullPushRetryDelay, err = time.ParseDuration(iopts.RetryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.RetryDelay, err)
}

options := buildah.BuilderOptions{
FromImage: args[0],
Container: iopts.name,
Expand All @@ -296,10 +290,16 @@ func fromCmd(c *cobra.Command, args []string, iopts fromReply) error {
BlobDirectory: iopts.BlobCache,
Devices: devices,
MaxPullRetries: iopts.Retry,
PullRetryDelay: pullPushRetryDelay,
OciDecryptConfig: decConfig,
}

if iopts.RetryDelay != "" {
options.PullRetryDelay, err = time.ParseDuration(iopts.RetryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.RetryDelay, err)
}
}

if !iopts.quiet {
options.ReportWriter = os.Stderr
}
Expand Down
16 changes: 9 additions & 7 deletions cmd/buildah/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func init() {
}
flags.BoolVar(&manifestPushOpts.tlsVerify, "tls-verify", true, "require HTTPS and verify certificates when accessing the registry. TLS verification cannot be used when talking to an insecure registry.")
flags.BoolVarP(&manifestPushOpts.quiet, "quiet", "q", false, "don't output progress information when pushing lists")
flags.IntVar(&manifestPushOpts.retry, "retry", cli.MaxPullPushRetries, "number of times to retry in case of failure when performing push")
flags.StringVar(&manifestPushOpts.retryDelay, "retry-delay", cli.PullPushRetryDelay.String(), "delay between retries in case of push failures")
flags.IntVar(&manifestPushOpts.retry, "retry", int(defaultContainerConfig.Engine.Retry), "number of times to retry in case of failure when performing push")
flags.StringVar(&manifestPushOpts.retryDelay, "retry-delay", defaultContainerConfig.Engine.RetryDelay, "delay between retries in case of push failures")
flags.SetNormalizeFunc(cli.AliasFlags)
manifestCommand.AddCommand(manifestPushCommand)

Expand Down Expand Up @@ -1161,10 +1161,6 @@ func manifestPush(systemContext *types.SystemContext, store storage.Store, listI
}

retry := uint(opts.retry)
retryDelay, err := time.ParseDuration(opts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse retryDelay %q: %w", opts.retryDelay, err)
}

options := manifests.PushOptions{
Store: store,
Expand All @@ -1177,7 +1173,13 @@ func manifestPush(systemContext *types.SystemContext, store storage.Store, listI
AddCompression: opts.addCompression,
ForceCompressionFormat: opts.forceCompressionFormat,
MaxRetries: &retry,
RetryDelay: &retryDelay,
}
if opts.retryDelay != "" {
retryDelay, err := time.ParseDuration(opts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse retryDelay %q: %w", opts.retryDelay, err)
}
options.RetryDelay = &retryDelay
}
if opts.all {
options.ImageListSelection = cp.CopyAllImages
Expand Down
17 changes: 9 additions & 8 deletions cmd/buildah/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func init() {
flags.StringSlice("platform", []string{parse.DefaultPlatform()}, "prefer OS/ARCH instead of the current operating system and architecture for choosing images")
flags.String("variant", "", "override the `variant` of the specified image")
flags.BoolVar(&opts.tlsVerify, "tls-verify", true, "require HTTPS and verify certificates when accessing the registry. TLS verification cannot be used when talking to an insecure registry.")
flags.IntVar(&opts.retry, "retry", cli.MaxPullPushRetries, "number of times to retry in case of failure when performing pull")
flags.StringVar(&opts.retryDelay, "retry-delay", cli.PullPushRetryDelay.String(), "delay between retries in case of pull failures")
flags.IntVar(&opts.retry, "retry", int(defaultContainerConfig.Engine.Retry), "number of times to retry in case of failure when performing pull")
flags.StringVar(&opts.retryDelay, "retry-delay", defaultContainerConfig.Engine.RetryDelay, "delay between retries in case of pull failures")
if err := flags.MarkHidden("blob-cache"); err != nil {
panic(fmt.Sprintf("error marking blob-cache as hidden: %v", err))
}
Expand Down Expand Up @@ -123,11 +123,6 @@ func pullCmd(c *cobra.Command, args []string, iopts pullOptions) error {
if !ok {
return fmt.Errorf("unsupported pull policy %q", iopts.pullPolicy)
}
var pullPushRetryDelay time.Duration
pullPushRetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
options := buildah.PullOptions{
SignaturePolicyPath: iopts.signaturePolicy,
Store: store,
Expand All @@ -137,11 +132,17 @@ func pullCmd(c *cobra.Command, args []string, iopts pullOptions) error {
ReportWriter: os.Stderr,
RemoveSignatures: iopts.removeSignatures,
MaxRetries: iopts.retry,
RetryDelay: pullPushRetryDelay,
OciDecryptConfig: decConfig,
PullPolicy: policy,
}

if iopts.retryDelay != "" {
options.RetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
}

if iopts.quiet {
options.ReportWriter = nil // Turns off logging output
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/buildah/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func init() {
flags.StringVar(&opts.compressionFormat, "compression-format", "", "compression format to use")
flags.IntVar(&opts.compressionLevel, "compression-level", 0, "compression level to use")
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "don't output progress information when pushing images")
flags.IntVar(&opts.retry, "retry", cli.MaxPullPushRetries, "number of times to retry in case of failure when performing push/pull")
flags.StringVar(&opts.retryDelay, "retry-delay", cli.PullPushRetryDelay.String(), "delay between retries in case of push/pull failures")
flags.IntVar(&opts.retry, "retry", int(defaultContainerConfig.Engine.Retry), "number of times to retry in case of failure when performing push")
flags.StringVar(&opts.retryDelay, "retry-delay", defaultContainerConfig.Engine.RetryDelay, "delay between retries in case of push failures")
flags.BoolVar(&opts.rm, "rm", false, "remove the manifest list if push succeeds")
flags.BoolVarP(&opts.removeSignatures, "remove-signatures", "", false, "don't copy signatures when pushing image")
flags.StringVar(&opts.signBy, "sign-by", "", "sign the image using a GPG key with the specified `FINGERPRINT`")
Expand Down Expand Up @@ -194,11 +194,6 @@ func pushCmd(c *cobra.Command, args []string, iopts pushOptions) error {
return fmt.Errorf("unable to obtain encryption config: %w", err)
}

var pullPushRetryDelay time.Duration
pullPushRetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
if c.Flag("compression-format").Changed {
if !c.Flag("force-compression").Changed {
// If `compression-format` is set and no value for `--force-compression`
Expand All @@ -217,11 +212,16 @@ func pushCmd(c *cobra.Command, args []string, iopts pushOptions) error {
RemoveSignatures: iopts.removeSignatures,
SignBy: iopts.signBy,
MaxRetries: iopts.retry,
RetryDelay: pullPushRetryDelay,
OciEncryptConfig: encConfig,
OciEncryptLayers: encLayers,
ForceCompressionFormat: iopts.forceCompressionFormat,
}
if iopts.retryDelay != "" {
options.RetryDelay, err = time.ParseDuration(iopts.retryDelay)
if err != nil {
return fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.retryDelay, err)
}
}
if !iopts.quiet {
options.ReportWriter = os.Stderr
}
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ require (
github.com/containerd/containerd v1.7.13
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.4.0
github.com/containers/common v0.57.1-0.20240208111739-bed861a11acc
github.com/containers/image/v5 v5.29.3-0.20240207231441-93b4b55d865b
github.com/containers/common v0.57.1-0.20240220203037-6ee157e78afb
github.com/containers/image/v5 v5.29.3-0.20240215171532-36cc6a1a006f
github.com/containers/luksy v0.0.0-20240129181507-b62d551ce6d8
github.com/containers/ocicrypt v1.1.9
github.com/containers/storage v1.52.1-0.20240206205149-d1bf4f0cf1d6
github.com/containers/storage v1.52.1-0.20240215002116-8a099ece355e
github.com/cyphar/filepath-securejoin v0.2.4
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v25.0.3+incompatible
Expand All @@ -24,7 +24,7 @@ require (
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0
github.com/opencontainers/runc v1.1.12
github.com/opencontainers/runtime-spec v1.1.0
github.com/opencontainers/runtime-spec v1.2.0
github.com/opencontainers/runtime-tools v0.9.1-0.20230914150019-408c51e934dc
github.com/opencontainers/selinux v1.11.0
github.com/openshift/imagebuilder v1.2.6
Expand Down Expand Up @@ -155,3 +155,5 @@ require (
k8s.io/klog v1.0.0 // indirect
tags.cncf.io/container-device-interface v0.6.2 // indirect
)

replace github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v1.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the replace?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crun on debian is not updated to a version that will work, so in order to move forward we are not advancing the runtime-spec. As soon as debian moves forward this can be removed.

This will not effect the effect the eventual podman build PR

12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ github.com/containernetworking/cni v1.1.2 h1:wtRGZVv7olUHMOqouPpn3cXJWpJgM6+EUl3
github.com/containernetworking/cni v1.1.2/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
github.com/containernetworking/plugins v1.4.0 h1:+w22VPYgk7nQHw7KT92lsRmuToHvb7wwSv9iTbXzzic=
github.com/containernetworking/plugins v1.4.0/go.mod h1:UYhcOyjefnrQvKvmmyEKsUA+M9Nfn7tqULPpH0Pkcj0=
github.com/containers/common v0.57.1-0.20240208111739-bed861a11acc h1:tEyx/pMn58A4a8kRZTKc7X4BLA9lqhMphPsvR3jUeCA=
github.com/containers/common v0.57.1-0.20240208111739-bed861a11acc/go.mod h1:Al9edwL72aYyVOfIE+DB635ltve3S98TrQgg/Tv5PLE=
github.com/containers/image/v5 v5.29.3-0.20240207231441-93b4b55d865b h1:SDiNbvEwiBB0TdoIBkfkY39FD1c2jzL3aJIXRsSr0oA=
github.com/containers/image/v5 v5.29.3-0.20240207231441-93b4b55d865b/go.mod h1:hD2xTPHZ/QaNHhxx92ysHfy8OlrakkfkHQkaz4tD7Gs=
github.com/containers/common v0.57.1-0.20240220203037-6ee157e78afb h1:i/kvuY7/Pu2hUgaJCqK4lbnVeXRCFDpvwJvfMv0i9Bs=
github.com/containers/common v0.57.1-0.20240220203037-6ee157e78afb/go.mod h1:pc++5s/cvBtAkoAZ9d6czDqYer0yydX3d8LH6ALnwtA=
github.com/containers/image/v5 v5.29.3-0.20240215171532-36cc6a1a006f h1:MCF+RnayfstZufkmBHnGk/2VQdE0GOT19SQolKgDgiw=
github.com/containers/image/v5 v5.29.3-0.20240215171532-36cc6a1a006f/go.mod h1:ukAnxANdFyEQEh68xsxqMzh77pTelne9sCNrj9pJTL4=
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYglewc+UyGf6lc8Mj2UaPTHy/iF2De0/77CA=
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
github.com/containers/luksy v0.0.0-20240129181507-b62d551ce6d8 h1:0p58QJRICjkRVCDix1nsnyrtJ3Qj4CWcGd1bOEY9sVY=
github.com/containers/luksy v0.0.0-20240129181507-b62d551ce6d8/go.mod h1:oMhW1fWXz1FGN97rhycbuAwrkXXV1z5c/Bjbn0CSlFY=
github.com/containers/ocicrypt v1.1.9 h1:2Csfba4jse85Raxk5HIyEk8OwZNjRvfkhEGijOjIdEM=
github.com/containers/ocicrypt v1.1.9/go.mod h1:dTKx1918d8TDkxXvarscpNVY+lyPakPNFN4jwA9GBys=
github.com/containers/storage v1.52.1-0.20240206205149-d1bf4f0cf1d6 h1:FCAoj1Q5wtIS+SPl1NzAUKhf/ugO25/RO3h1QKgOiXU=
github.com/containers/storage v1.52.1-0.20240206205149-d1bf4f0cf1d6/go.mod h1:Q0mbK3IWYQGXOUmBbpbfKOAMxw8PER7KLnzeGFBqlRM=
github.com/containers/storage v1.52.1-0.20240215002116-8a099ece355e h1:HcWQk5se8sqd+5O7oL+c2gkWWLFiDm7ibb3V1XVdhQA=
github.com/containers/storage v1.52.1-0.20240215002116-8a099ece355e/go.mod h1:FCCDayvfq7vFe0I/8/KP15TggifktwBtla+62oEBnug=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down
17 changes: 9 additions & 8 deletions pkg/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,6 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
iopts.NoCache = true
}
}
var pullPushRetryDelay time.Duration
pullPushRetryDelay, err = time.ParseDuration(iopts.RetryDelay)
if err != nil {
return options, nil, nil, fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.RetryDelay, err)
}
// Following log line is used in integration test.
logrus.Debugf("Setting MaxPullPushRetries to %d and PullPushRetryDelay to %v", iopts.Retry, pullPushRetryDelay)

if c.Flag("network").Changed && c.Flag("isolation").Changed {
if isolation == define.IsolationChroot {
Expand Down Expand Up @@ -405,7 +398,6 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
OutputFormat: format,
Platforms: platforms,
PullPolicy: pullPolicy,
PullPushRetryDelay: pullPushRetryDelay,
Quiet: iopts.Quiet,
RemoveIntermediateCtrs: iopts.Rm,
ReportWriter: reporter,
Expand All @@ -424,6 +416,15 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
UnsetEnvs: iopts.UnsetEnvs,
UnsetLabels: iopts.UnsetLabels,
}
if iopts.RetryDelay != "" {
options.PullPushRetryDelay, err = time.ParseDuration(iopts.RetryDelay)
if err != nil {
return options, nil, nil, fmt.Errorf("unable to parse value provided %q as --retry-delay: %w", iopts.RetryDelay, err)
}
// Following log line is used in integration test.
logrus.Debugf("Setting MaxPullPushRetries to %d and PullPushRetryDelay to %v", iopts.Retry, options.PullPushRetryDelay)
}

if iopts.Quiet {
options.ReportWriter = io.Discard
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ func GetFromAndBudFlags(flags *FromAndBudResults, usernsResults *UserNSResults,
fs.StringVar(&flags.Isolation, "isolation", DefaultIsolation(), "`type` of process isolation to use. Use BUILDAH_ISOLATION environment variable to override.")
fs.StringVarP(&flags.Memory, "memory", "m", "", "memory limit (format: <number>[<unit>], where unit = b, k, m or g)")
fs.StringVar(&flags.MemorySwap, "memory-swap", "", "swap limit equal to memory plus swap: '-1' to enable unlimited swap")
fs.IntVar(&flags.Retry, "retry", MaxPullPushRetries, "number of times to retry in case of failure when performing push/pull")
fs.StringVar(&flags.RetryDelay, "retry-delay", PullPushRetryDelay.String(), "delay between retries in case of push/pull failures")
fs.IntVar(&flags.Retry, "retry", int(defaultContainerConfig.Engine.Retry), "number of times to retry in case of failure when performing push/pull")
fs.StringVar(&flags.RetryDelay, "retry-delay", defaultContainerConfig.Engine.RetryDelay, "delay between retries in case of push/pull failures")
fs.String("arch", runtime.GOARCH, "set the ARCH of the image to the provided value instead of the architecture of the host")
fs.String("os", runtime.GOOS, "prefer `OS` instead of the running OS when pulling images")
fs.StringSlice("platform", []string{parse.DefaultPlatform()}, "set the `OS/ARCH[/VARIANT]` of the image to the provided value instead of the current operating system and architecture of the host (for example \"linux/arm\")")
Expand Down
4 changes: 2 additions & 2 deletions tests/bud.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6618,10 +6618,10 @@ _EOF
skip_if_no_runtime
_prefetch alpine

run podman run --rm alpine sh -c "echo -n Files=; awk '/open files/{print \$4 \"/\" \$5}' /proc/self/limits"
run podman --events-backend=none run --rm alpine sh -c "echo -n Files=; awk '/open files/{print \$4 \"/\" \$5}' /proc/self/limits"
podman_files=$output

run podman run --rm alpine sh -c "echo -n Processes=; awk '/processes/{print \$3 \"/\" \$4}' /proc/self/limits"
run podman --events-backend=none run --rm alpine sh -c "echo -n Processes=; awk '/processes/{print \$3 \"/\" \$4}' /proc/self/limits"
podman_processes=$output

CONTAINERS_CONF=/dev/null run_buildah build --no-cache --pull=false $WITH_POLICY_JSON -t foo/bar $BUDFILES/bud.limits
Expand Down
29 changes: 29 additions & 0 deletions tests/containers_conf.bats
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,32 @@ _EOF
fi

}


@test "containers.conf retry" {
cat >${TEST_SCRATCH_DIR}/containers.conf << EOF
[engine]
retry=10
retry_delay="5s"
EOF
_prefetch alpine
CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah build --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"

CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah push --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"

CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah pull --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"

CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah from --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"

CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah manifest push --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"
}
2 changes: 1 addition & 1 deletion tests/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ COPY_BINARY=${COPY_BINARY:-$TEST_SOURCES/../bin/copy}
TUTORIAL_BINARY=${TUTORIAL_BINARY:-$TEST_SOURCES/../bin/tutorial}
STORAGE_DRIVER=${STORAGE_DRIVER:-vfs}
PATH=$(dirname ${BASH_SOURCE})/../bin:${PATH}
OCI=$(${BUILDAH_BINARY} info --format '{{.host.OCIRuntime}}' || command -v runc || command -v crun)
OCI=${CI_DESIRED_RUNTIME:-$(${BUILDAH_BINARY} info --format '{{.host.OCIRuntime}}' || command -v runc || command -v crun)}
# Default timeout for a buildah command.
BUILDAH_TIMEOUT=${BUILDAH_TIMEOUT:-300}

Expand Down
Loading
Loading