mirror of
https://github.com/containers/buildah.git
synced 2025-07-30 04:23:09 +03:00
bud: teach --platform to take a list
Add a pkg/parse.PlatformsFromOptions() which understands a "variant" value as an optional third value in an OS/ARCH[/VARIANT] argument value, which accepts a comma-separated list of them, and which returns a list of platforms. Teach "from" and "pull" about the --platform option and add integration tests for them, warning if --platform was given multiple values. Add a define.BuildOptions.JobSemaphore which an imagebuildah executor will use in preference to one that it might allocate for itself. In main(), allocate a JobSemaphore if the number of jobs is not 0 (which we treat as "unlimited", and continue to allow executors to do). In addManifest(), take a lock on the manifest list's image ID so that we don't overwrite changes that another thread might be making while we're attempting to make changes to it. In main(), create an empty list if the list doesn't already exist before we start down this path, so that we don't get two threads trying to create that manifest list at the same time later on. Two processes could still try to create the same list twice, but it's an incremental improvement. Finally, if we've been given multiple platforms to build for, run their builds concurrently and gather up their results. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
@ -183,6 +183,12 @@ func (b *Builder) addManifest(ctx context.Context, manifestName string, imageSpe
|
||||
create = true
|
||||
list = manifests.Create()
|
||||
} else {
|
||||
locker, err := manifests.LockerForImage(b.store, manifestList.ID())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
locker.Lock()
|
||||
defer locker.Unlock()
|
||||
_, list, err = manifests.LoadFromImage(b.store, manifestList.ID())
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Reference in New Issue
Block a user