diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-17 14:30:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 14:30:49 -0400 |
commit | a5884c07dfb092eab88cf153238e714910388a06 (patch) | |
tree | 2ff9de3f27c2cc9f9cc4b630494b93aeab78fc46 /pkg/domain | |
parent | d68b028c9440cd3f952327b05f1bc8dee00ab98a (diff) | |
parent | 60624f948bf0067059f3d05e1bdc54589a9911e9 (diff) | |
download | podman-a5884c07dfb092eab88cf153238e714910388a06.tar.gz podman-a5884c07dfb092eab88cf153238e714910388a06.tar.bz2 podman-a5884c07dfb092eab88cf153238e714910388a06.zip |
Merge pull request #5819 from vrothberg/v2-build
podmanV2: implement build
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/engine_image.go | 1 | ||||
-rw-r--r-- | pkg/domain/entities/types.go | 12 | ||||
-rw-r--r-- | pkg/domain/infra/abi/images.go | 8 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/images.go | 4 |
4 files changed, 25 insertions, 0 deletions
diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go index e3b606550..052e7bee5 100644 --- a/pkg/domain/entities/engine_image.go +++ b/pkg/domain/entities/engine_image.go @@ -7,6 +7,7 @@ import ( ) type ImageEngine interface { + Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error) Config(ctx context.Context) (*config.Config, error) Delete(ctx context.Context, nameOrId []string, opts ImageDeleteOptions) (*ImageDeleteReport, error) Diff(ctx context.Context, nameOrId string, options DiffOptions) (*DiffReport, error) diff --git a/pkg/domain/entities/types.go b/pkg/domain/entities/types.go index 31a05f5d3..e4e1c3ad2 100644 --- a/pkg/domain/entities/types.go +++ b/pkg/domain/entities/types.go @@ -4,6 +4,7 @@ import ( "errors" "net" + "github.com/containers/buildah/imagebuildah" "github.com/containers/libpod/libpod/events" "github.com/containers/libpod/pkg/specgen" "github.com/containers/storage/pkg/archive" @@ -104,3 +105,14 @@ func (e ErrorModel) Cause() error { func (e ErrorModel) Code() int { return e.ResponseCode } + +// BuildOptions describe the options for building container images. +type BuildOptions struct { + imagebuildah.BuildOptions +} + +// BuildReport is the image-build report. +type BuildReport struct { + // ID of the image. + ID string +} diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 9467c14d4..0f710ad28 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -468,3 +468,11 @@ func (ir *ImageEngine) Search(ctx context.Context, term string, opts entities.Im func (ir *ImageEngine) Config(_ context.Context) (*config.Config, error) { return ir.Libpod.GetConfig() } + +func (ir *ImageEngine) Build(ctx context.Context, containerFiles []string, opts entities.BuildOptions) (*entities.BuildReport, error) { + id, _, err := ir.Libpod.Build(ctx, opts.BuildOptions, containerFiles...) + if err != nil { + return nil, err + } + return &entities.BuildReport{ID: id}, nil +} diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index 7d40e0327..6ea2bd9f2 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -259,3 +259,7 @@ func (ir *ImageEngine) Search(ctx context.Context, term string, opts entities.Im func (ir *ImageEngine) Config(_ context.Context) (*config.Config, error) { return config.Default() } + +func (ir *ImageEngine) Build(ctx context.Context, containerFiles []string, opts entities.BuildOptions) (*entities.BuildReport, error) { + return nil, errors.New("not implemented yet") +} |