vendor: update buildah to latest main

Includes one breaking change for the flag as BuildOutputs now accept a
slice.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-06-05 11:47:46 +02:00
parent 96abeafc61
commit ac71bc6cf2
39 changed files with 824 additions and 234 deletions

View File

@@ -25,8 +25,8 @@ before_install:
- docker pull centos:7
- docker pull alpine
- docker pull registry.fedoraproject.org/fedora-minimal
- docker pull registry.fedoraproject.org/fedora-minimal:41-x86_64
- docker pull registry.fedoraproject.org/fedora-minimal:41-aarch64
- docker pull registry.fedoraproject.org/fedora-minimal:42-x86_64
- docker pull registry.fedoraproject.org/fedora-minimal:42-aarch64
- chmod -R go-w ./dockerclient/testdata
script:

View File

@@ -106,8 +106,8 @@ docker rmi busybox; docker pull busybox
docker rmi alpine; docker pull alpine
docker rmi centos:7; docker pull centos:7
docker rmi registry.fedoraproject.org/fedora-minimal; docker pull registry.fedoraproject.org/fedora-minimal
docker rmi registry.fedoraproject.org/fedora-minimal:41-x86_64; docker pull registry.fedoraproject.org/fedora-minimal:41-x86_64
docker rmi registry.fedoraproject.org/fedora-minimal:41-aarch64; docker pull registry.fedoraproject.org/fedora-minimal:41-aarch64
docker rmi registry.fedoraproject.org/fedora-minimal:42-x86_64; docker pull registry.fedoraproject.org/fedora-minimal:42-x86_64
docker rmi registry.fedoraproject.org/fedora-minimal:42-aarch64; docker pull registry.fedoraproject.org/fedora-minimal:42-aarch64
chmod -R go-w ./dockerclient/testdata
go test ./dockerclient -tags conformance -timeout 30m
```

View File

@@ -2,6 +2,7 @@ package imagebuilder
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
@@ -9,6 +10,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"strconv"
"strings"
@@ -288,6 +290,55 @@ type Stage struct {
}
func NewStages(node *parser.Node, b *Builder) (Stages, error) {
getStageFrom := func(stageIndex int, root *parser.Node) (from string, as string, err error) {
for _, child := range root.Children {
if !strings.EqualFold(child.Value, command.From) {
continue
}
if child.Next == nil {
return "", "", errors.New("FROM requires an argument")
}
if child.Next.Value == "" {
return "", "", errors.New("FROM requires a non-empty argument")
}
from = child.Next.Value
if name, ok := extractNameFromNode(child); ok {
as = name
}
return from, as, nil
}
return "", "", fmt.Errorf("stage %d requires a FROM instruction (%q)", stageIndex+1, root.Original)
}
argInstructionsInStages := make(map[string][]string)
setStageInheritedArgs := func(s *Stage) error {
from, as, err := getStageFrom(s.Position, s.Node)
if err != nil {
return err
}
inheritedArgs := argInstructionsInStages[from]
thisStageArgs := slices.Clone(inheritedArgs)
for _, child := range s.Node.Children {
if !strings.EqualFold(child.Value, command.Arg) {
continue
}
if child.Next == nil {
return errors.New("ARG requires an argument")
}
if child.Next.Value == "" {
return errors.New("ARG requires a non-empty argument")
}
next := child.Next
for next != nil {
thisStageArgs = append(thisStageArgs, next.Value)
next = next.Next
}
}
if as != "" {
argInstructionsInStages[as] = thisStageArgs
}
argInstructionsInStages[strconv.Itoa(s.Position)] = thisStageArgs
return arg(s.Builder, inheritedArgs, nil, nil, "", nil)
}
var stages Stages
var headingArgs []string
if err := b.extractHeadingArgsFromNode(node); err != nil {
@@ -297,8 +348,8 @@ func NewStages(node *parser.Node, b *Builder) (Stages, error) {
headingArgs = append(headingArgs, k)
}
for i, root := range SplitBy(node, command.From) {
name, _ := extractNameFromNode(root.Children[0])
if len(name) == 0 {
name, hasName := extractNameFromNode(root.Children[0])
if !hasName {
name = strconv.Itoa(i)
}
filteredUserArgs := make(map[string]string)
@@ -317,12 +368,16 @@ func NewStages(node *parser.Node, b *Builder) (Stages, error) {
if err != nil {
return nil, err
}
stages = append(stages, Stage{
stage := Stage{
Position: i,
Name: processedName,
Builder: b.builderForStage(headingArgs),
Node: root,
})
}
if err := setStageInheritedArgs(&stage); err != nil {
return nil, err
}
stages = append(stages, stage)
}
return stages, nil
}

View File

@@ -12,7 +12,7 @@
#
%global golang_version 1.19
%{!?version: %global version 1.2.16-dev}
%{!?version: %global version 1.2.16}
%{!?release: %global release 1}
%global package_name imagebuilder
%global product_name Container Image Builder