diff --git a/go.mod b/go.mod index db22f4b14f..ba91c18369 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/checkpoint-restore/checkpointctl v1.3.0 github.com/checkpoint-restore/go-criu/v7 v7.2.0 github.com/containernetworking/plugins v1.6.2 - github.com/containers/buildah v1.39.1-0.20250324153001-6d9381d08265 + github.com/containers/buildah v1.39.1-0.20250401180830-32d78c69be17 github.com/containers/common v0.62.4-0.20250401165412-9b0d134f392f github.com/containers/conmon v2.0.20+incompatible github.com/containers/gvisor-tap-vsock v0.8.5 @@ -151,7 +151,7 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mistifyio/go-zfs/v3 v3.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/buildkit v0.20.1 // indirect + github.com/moby/buildkit v0.20.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect diff --git a/go.sum b/go.sum index 922c6bd16d..2ae8459587 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,8 @@ github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8F github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M= github.com/containernetworking/plugins v1.6.2 h1:pqP8Mq923TLyef5g97XfJ/xpDeVek4yF8A4mzy9Tc4U= github.com/containernetworking/plugins v1.6.2/go.mod h1:SP5UG3jDO9LtmfbBJdP+nl3A1atOtbj2MBOYsnaxy64= -github.com/containers/buildah v1.39.1-0.20250324153001-6d9381d08265 h1:3cFRoMP4Up4sN/f2TOcCKSxiX/mbHCN5FwqHc+rw2B8= -github.com/containers/buildah v1.39.1-0.20250324153001-6d9381d08265/go.mod h1:8DuzWORynpU4q7coSL0aElpPVMDZFoCOnz9gzqU8Ics= +github.com/containers/buildah v1.39.1-0.20250401180830-32d78c69be17 h1:mfnd0BqHdV8p6+pol7SelIEgG7NbJQYW4IPywGakmCY= +github.com/containers/buildah v1.39.1-0.20250401180830-32d78c69be17/go.mod h1:AvIRsFvWfSuMNGoMm8hXFaOGvzhsnujWz1C38rk+mk4= github.com/containers/common v0.62.4-0.20250401165412-9b0d134f392f h1:gpfCIBHhMAzJGEPjCrCAS18Pop+RgQSK38Grre/+gqQ= github.com/containers/common v0.62.4-0.20250401165412-9b0d134f392f/go.mod h1:B6J/JCUcc9vgeoBFFzL5QGszpa7SoVK+mAyUNXSWI6s= github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg= @@ -318,8 +318,8 @@ github.com/mistifyio/go-zfs/v3 v3.0.1 h1:YaoXgBePoMA12+S1u/ddkv+QqxcfiZK4prI6HPn github.com/mistifyio/go-zfs/v3 v3.0.1/go.mod h1:CzVgeB0RvF2EGzQnytKVvVSDwmKJXxkOTUGbNrTja/k= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/buildkit v0.20.1 h1:sT0ZXhhNo5rVbMcYfgttma3TdUHfO5JjFA0UAL8p9fY= -github.com/moby/buildkit v0.20.1/go.mod h1:Rq9nB/fJImdk6QeM0niKtOHJqwKeYMrK847hTTDVuA4= +github.com/moby/buildkit v0.20.2 h1:qIeR47eQ1tzI1rwz0on3Xx2enRw/1CKjFhoONVcTlMA= +github.com/moby/buildkit v0.20.2/go.mod h1:DhaF82FjwOElTftl0JUAJpH/SUIUx4UvcFncLeOtlDI= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= diff --git a/test/buildah-bud/apply-podman-deltas b/test/buildah-bud/apply-podman-deltas index f6e73a3231..da4517e2d6 100755 --- a/test/buildah-bud/apply-podman-deltas +++ b/test/buildah-bud/apply-podman-deltas @@ -273,6 +273,10 @@ skip_if_remote "Weird. This used to work remote, until Ed set TMPDIR in #5804" \ skip_if_remote "This test needs unique TMPDIR for the test and podman-remote does not propagates ENV from client-side to server-end" \ "bud-with-mount-cache-like-buildkit" +# 2025-04-01 skip test as it is incompatible with compat API in podman-remote +skip_if_remote "compat API does not support oci-archive tags" \ + "build-with-timestamp-applies-to-oci-archive" + ############################################################################### # BEGIN tests which are skipped due to actual podman or podman-remote bugs. @@ -320,6 +324,10 @@ skip "FIXME: 2024-05-28 new VMs from #338" \ "bud-git-context-subdirectory" \ "bud using gitrepo and branch" +# 2025-04-01 FIXME wrong exit code from git related failures from #25756 +skip_if_remote "FIXME: 2025-04-01 git related errors returning wrong exit code" \ + "bud with ADD with git repository source" + # END temporary workarounds that must be reevaluated periodically ############################################################################### diff --git a/vendor/github.com/containers/buildah/.cirrus.yml b/vendor/github.com/containers/buildah/.cirrus.yml index c1db920ba0..b3ec30676e 100644 --- a/vendor/github.com/containers/buildah/.cirrus.yml +++ b/vendor/github.com/containers/buildah/.cirrus.yml @@ -33,7 +33,7 @@ env: DEBIAN_NAME: "debian-13" # Image identifiers - IMAGE_SUFFIX: "c20250131t121915z-f41f40d13" + IMAGE_SUFFIX: "c20250324t111922z-f41f40d13" FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}" PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}" DEBIAN_CACHE_IMAGE_NAME: "debian-${IMAGE_SUFFIX}" diff --git a/vendor/github.com/containers/buildah/add.go b/vendor/github.com/containers/buildah/add.go index b19ff8b7b8..213da4f000 100644 --- a/vendor/github.com/containers/buildah/add.go +++ b/vendor/github.com/containers/buildah/add.go @@ -516,8 +516,13 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption wg.Add(1) if sourceIsGit(src) { go func() { + defer wg.Done() + defer pipeWriter.Close() var cloneDir, subdir string cloneDir, subdir, getErr = define.TempDirForURL(tmpdir.GetTempDir(), "", src) + if getErr != nil { + return + } getOptions := copier.GetOptions{ UIDMap: srcUIDMap, GIDMap: srcGIDMap, @@ -534,8 +539,6 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption writer := io.WriteCloser(pipeWriter) repositoryDir := filepath.Join(cloneDir, subdir) getErr = copier.Get(repositoryDir, repositoryDir, getOptions, []string{"."}, writer) - pipeWriter.Close() - wg.Done() }() } else { go func() { diff --git a/vendor/github.com/containers/buildah/chroot/run_linux.go b/vendor/github.com/containers/buildah/chroot/run_linux.go index 76900d7f0c..cd19fa0173 100644 --- a/vendor/github.com/containers/buildah/chroot/run_linux.go +++ b/vendor/github.com/containers/buildah/chroot/run_linux.go @@ -263,7 +263,7 @@ func createPlatformContainer(options runUsingChrootExecSubprocOptions) error { return fmt.Errorf("changing to host root directory: %w", err) } // make sure we only unmount things under this tree - if err := unix.Mount(".", ".", "bind", unix.MS_REMOUNT|unix.MS_BIND|unix.MS_SLAVE|unix.MS_REC, ""); err != nil { + if err := unix.Mount(".", ".", "", unix.MS_SLAVE|unix.MS_REC, ""); err != nil { return fmt.Errorf("tweaking mount flags on host root directory before unmounting from mount namespace: %w", err) } // detach this (unnamed?) old directory diff --git a/vendor/github.com/containers/buildah/commit.go b/vendor/github.com/containers/buildah/commit.go index a3f04ca6e6..efe96f1ce4 100644 --- a/vendor/github.com/containers/buildah/commit.go +++ b/vendor/github.com/containers/buildah/commit.go @@ -415,7 +415,7 @@ func (b *Builder) Commit(ctx context.Context, dest types.ImageReference, options } var manifestBytes []byte - if manifestBytes, err = retryCopyImage(ctx, policyContext, maybeCachedDest, maybeCachedSrc, dest, getCopyOptions(b.store, options.ReportWriter, nil, systemContext, "", false, options.SignBy, options.OciEncryptLayers, options.OciEncryptConfig, nil), options.MaxRetries, options.RetryDelay); err != nil { + if manifestBytes, err = retryCopyImage(ctx, policyContext, maybeCachedDest, maybeCachedSrc, dest, getCopyOptions(b.store, options.ReportWriter, nil, systemContext, "", false, options.SignBy, options.OciEncryptLayers, options.OciEncryptConfig, nil, options.HistoryTimestamp), options.MaxRetries, options.RetryDelay); err != nil { return imgID, nil, "", fmt.Errorf("copying layers and metadata for container %q: %w", b.ContainerID, err) } // If we've got more names to attach, and we know how to do that for diff --git a/vendor/github.com/containers/buildah/common.go b/vendor/github.com/containers/buildah/common.go index 92a7cffff6..ed8fc17ed5 100644 --- a/vendor/github.com/containers/buildah/common.go +++ b/vendor/github.com/containers/buildah/common.go @@ -27,7 +27,7 @@ const ( DOCKER = define.DOCKER ) -func getCopyOptions(store storage.Store, reportWriter io.Writer, sourceSystemContext *types.SystemContext, destinationSystemContext *types.SystemContext, manifestType string, removeSignatures bool, addSigner string, ociEncryptLayers *[]int, ociEncryptConfig *encconfig.EncryptConfig, ociDecryptConfig *encconfig.DecryptConfig) *cp.Options { +func getCopyOptions(store storage.Store, reportWriter io.Writer, sourceSystemContext *types.SystemContext, destinationSystemContext *types.SystemContext, manifestType string, removeSignatures bool, addSigner string, ociEncryptLayers *[]int, ociEncryptConfig *encconfig.EncryptConfig, ociDecryptConfig *encconfig.DecryptConfig, destinationTimestamp *time.Time) *cp.Options { sourceCtx := getSystemContext(store, nil, "") if sourceSystemContext != nil { *sourceCtx = *sourceSystemContext @@ -47,6 +47,7 @@ func getCopyOptions(store storage.Store, reportWriter io.Writer, sourceSystemCon OciEncryptConfig: ociEncryptConfig, OciDecryptConfig: ociDecryptConfig, OciEncryptLayers: ociEncryptLayers, + DestinationTimestamp: destinationTimestamp, } } diff --git a/vendor/github.com/containers/buildah/copier/copier.go b/vendor/github.com/containers/buildah/copier/copier.go index c8411021ce..b0ea208df5 100644 --- a/vendor/github.com/containers/buildah/copier/copier.go +++ b/vendor/github.com/containers/buildah/copier/copier.go @@ -70,12 +70,14 @@ func extendedGlob(pattern string) (matches []string, err error) { components := []string{} dir := pattern file := "" - for dir != "" && dir != string(os.PathSeparator) { + for dir != filepath.VolumeName(dir) && dir != string(os.PathSeparator) { dir, file = filepath.Split(dir) - components = append([]string{file}, components...) + if file != "" { + components = append([]string{file}, components...) + } dir = strings.TrimSuffix(dir, string(os.PathSeparator)) } - patterns := []string{string(os.PathSeparator)} + patterns := []string{filepath.VolumeName(dir) + string(os.PathSeparator)} for i := range components { var nextPatterns []string if components[i] == "**" { diff --git a/vendor/github.com/containers/buildah/define/types.go b/vendor/github.com/containers/buildah/define/types.go index 6097e99a07..d71b26d53c 100644 --- a/vendor/github.com/containers/buildah/define/types.go +++ b/vendor/github.com/containers/buildah/define/types.go @@ -260,13 +260,6 @@ func parseGitBuildContext(url string) (string, string, string) { return gitBranchPart[0], gitSubdir, gitBranch } -func isGitTag(remote, ref string) bool { - if _, err := exec.Command("git", "ls-remote", "--exit-code", remote, ref).Output(); err != nil { - return true - } - return false -} - func cloneToDirectory(url, dir string) ([]byte, string, error) { var cmd *exec.Cmd gitRepo, gitSubdir, gitRef := parseGitBuildContext(url) @@ -274,20 +267,18 @@ func cloneToDirectory(url, dir string) ([]byte, string, error) { cmd = exec.Command("git", "init", dir) combinedOutput, err := cmd.CombinedOutput() if err != nil { - return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git init`: %w", err) + // Return err.Error() instead of err as we want buildah to override error code with more predictable + // value. + return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git init`: %s", err.Error()) } // add origin cmd = exec.Command("git", "remote", "add", "origin", gitRepo) cmd.Dir = dir combinedOutput, err = cmd.CombinedOutput() if err != nil { - return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git remote add`: %w", err) - } - - if gitRef != "" { - if ok := isGitTag(url, gitRef); ok { - gitRef += ":refs/tags/" + gitRef - } + // Return err.Error() instead of err as we want buildah to override error code with more predictable + // value. + return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git remote add`: %s", err.Error()) } logrus.Debugf("fetching repo %q and branch (or commit ID) %q to %q", gitRepo, gitRef, dir) @@ -296,14 +287,18 @@ func cloneToDirectory(url, dir string) ([]byte, string, error) { cmd.Dir = dir combinedOutput, err = cmd.CombinedOutput() if err != nil { - return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git fetch`: %w", err) + // Return err.Error() instead of err as we want buildah to override error code with more predictable + // value. + return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git fetch`: %s", err.Error()) } cmd = exec.Command("git", "checkout", "FETCH_HEAD") cmd.Dir = dir combinedOutput, err = cmd.CombinedOutput() if err != nil { - return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git checkout`: %w", err) + // Return err.Error() instead of err as we want buildah to override error code with more predictable + // value. + return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git checkout`: %s", err.Error()) } return combinedOutput, gitSubdir, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5e1fed34a0..0ba6652345 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -110,7 +110,7 @@ github.com/containernetworking/cni/pkg/version # github.com/containernetworking/plugins v1.6.2 ## explicit; go 1.23 github.com/containernetworking/plugins/pkg/ns -# github.com/containers/buildah v1.39.1-0.20250324153001-6d9381d08265 +# github.com/containers/buildah v1.39.1-0.20250401180830-32d78c69be17 ## explicit; go 1.23.0 github.com/containers/buildah github.com/containers/buildah/bind @@ -706,7 +706,7 @@ github.com/mistifyio/go-zfs/v3 # github.com/mitchellh/mapstructure v1.5.0 ## explicit; go 1.14 github.com/mitchellh/mapstructure -# github.com/moby/buildkit v0.20.1 +# github.com/moby/buildkit v0.20.2 ## explicit; go 1.22.0 github.com/moby/buildkit/frontend/dockerfile/command github.com/moby/buildkit/frontend/dockerfile/parser