mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Vendor Buildah v1.7
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com> Vendors in Buildah 1.7 into Podman. Also the latest imagebuilder and changes for `build --target` Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
This commit is contained in:
2
vendor/github.com/openshift/imagebuilder/README.md
generated
vendored
2
vendor/github.com/openshift/imagebuilder/README.md
generated
vendored
@ -70,7 +70,7 @@ is ignored.
|
||||
|
||||
## Code Example
|
||||
|
||||
```
|
||||
```go
|
||||
f, err := os.Open("path/to/Dockerfile")
|
||||
if err != nil {
|
||||
return err
|
||||
|
31
vendor/github.com/openshift/imagebuilder/builder.go
generated
vendored
31
vendor/github.com/openshift/imagebuilder/builder.go
generated
vendored
@ -40,6 +40,7 @@ type Run struct {
|
||||
|
||||
type Executor interface {
|
||||
Preserve(path string) error
|
||||
EnsureContainerPath(path string) error
|
||||
Copy(excludes []string, copies ...Copy) error
|
||||
Run(run Run, config docker.Config) error
|
||||
UnrecognizedInstruction(step *Step) error
|
||||
@ -52,6 +53,11 @@ func (logExecutor) Preserve(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (logExecutor) EnsureContainerPath(path string) error {
|
||||
log.Printf("ENSURE %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (logExecutor) Copy(excludes []string, copies ...Copy) error {
|
||||
for _, c := range copies {
|
||||
log.Printf("COPY %v -> %s (from:%s download:%t), chown: %s", c.Src, c.Dest, c.From, c.Download, c.Chown)
|
||||
@ -75,6 +81,10 @@ func (noopExecutor) Preserve(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (noopExecutor) EnsureContainerPath(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (noopExecutor) Copy(excludes []string, copies ...Copy) error {
|
||||
return nil
|
||||
}
|
||||
@ -153,6 +163,7 @@ func (stages Stages) ByName(name string) (Stage, bool) {
|
||||
return Stage{}, false
|
||||
}
|
||||
|
||||
// Get just the target stage.
|
||||
func (stages Stages) ByTarget(target string) (Stages, bool) {
|
||||
if len(target) == 0 {
|
||||
return stages, true
|
||||
@ -165,6 +176,19 @@ func (stages Stages) ByTarget(target string) (Stages, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// Get all the stages up to and including the target.
|
||||
func (stages Stages) ThroughTarget(target string) (Stages, bool) {
|
||||
if len(target) == 0 {
|
||||
return stages, true
|
||||
}
|
||||
for i, stage := range stages {
|
||||
if stage.Name == target {
|
||||
return stages[0 : i+1], true
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
type Stage struct {
|
||||
Position int
|
||||
Name string
|
||||
@ -319,6 +343,13 @@ func (b *Builder) Run(step *Step, exec Executor, noRunsRemaining bool) error {
|
||||
if err := exec.Copy(b.Excludes, copies...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(b.RunConfig.WorkingDir) > 0 {
|
||||
if err := exec.EnsureContainerPath(b.RunConfig.WorkingDir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, run := range runs {
|
||||
config := b.Config()
|
||||
config.Env = step.Env
|
||||
|
13
vendor/github.com/openshift/imagebuilder/dispatchers.go
generated
vendored
13
vendor/github.com/openshift/imagebuilder/dispatchers.go
generated
vendored
@ -128,9 +128,20 @@ func add(b *Builder, args []string, attributes map[string]bool, flagArgs []strin
|
||||
if len(args) < 2 {
|
||||
return errAtLeastOneArgument("ADD")
|
||||
}
|
||||
var chown string
|
||||
last := len(args) - 1
|
||||
dest := makeAbsolute(args[last], b.RunConfig.WorkingDir)
|
||||
b.PendingCopies = append(b.PendingCopies, Copy{Src: args[0:last], Dest: dest, Download: true})
|
||||
if len(flagArgs) > 0 {
|
||||
for _, arg := range flagArgs {
|
||||
switch {
|
||||
case strings.HasPrefix(arg, "--chown="):
|
||||
chown = strings.TrimPrefix(arg, "--chown=")
|
||||
default:
|
||||
return fmt.Errorf("ADD only supports the --chown=<uid:gid> flag")
|
||||
}
|
||||
}
|
||||
}
|
||||
b.PendingCopies = append(b.PendingCopies, Copy{Src: args[0:last], Dest: dest, Download: true, Chown: chown})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user