summaryrefslogtreecommitdiff
path: root/pkg/bindings/images
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-09-30 10:36:17 -0700
committerJhon Honce <jhonce@redhat.com>2021-09-30 14:30:06 -0700
commit648882bf64d781285cf874ea81f22ca554fc6058 (patch)
tree6a7952042afa7535fec690424f67cec81f9bed28 /pkg/bindings/images
parent6adf3293a02b84ed1060f87a36b3033f4a5357f5 (diff)
downloadpodman-648882bf64d781285cf874ea81f22ca554fc6058.tar.gz
podman-648882bf64d781285cf874ea81f22ca554fc6058.tar.bz2
podman-648882bf64d781285cf874ea81f22ca554fc6058.zip
Add guard for BuildOptions.CommonBuildOpts
Existing images.Build() bindings code panicked when field was not initialized. Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/bindings/images')
-rw-r--r--pkg/bindings/images/build.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 8cf4532d0..403d90721 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -16,6 +16,7 @@ import (
"strconv"
"strings"
+ "github.com/containers/buildah/define"
"github.com/containers/podman/v3/pkg/auth"
"github.com/containers/podman/v3/pkg/bindings"
"github.com/containers/podman/v3/pkg/domain/entities"
@@ -39,6 +40,10 @@ var (
// Build creates an image using a containerfile reference
func Build(ctx context.Context, containerFiles []string, options entities.BuildOptions) (*entities.BuildReport, error) {
+ if options.CommonBuildOpts == nil {
+ options.CommonBuildOpts = new(define.CommonBuildOptions)
+ }
+
params := url.Values{}
if caps := options.AddCapabilities; len(caps) > 0 {