summaryrefslogtreecommitdiff
path: root/pkg/bindings/images
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-09-30 10:36:17 -0700
committerMatthew Heon <matthew.heon@pm.me>2021-10-19 14:02:10 -0400
commit62d12a2adf1a33060e935c09fdbdabf4ecc16f33 (patch)
tree0086db03edb33eff5546d307acc889a8c200cc9f /pkg/bindings/images
parentc6be71486d4357cb3cbb380e846e32780fcb37f5 (diff)
downloadpodman-62d12a2adf1a33060e935c09fdbdabf4ecc16f33.tar.gz
podman-62d12a2adf1a33060e935c09fdbdabf4ecc16f33.tar.bz2
podman-62d12a2adf1a33060e935c09fdbdabf4ecc16f33.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 4d667d90a..4c3c83837 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 {