diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-12 12:59:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-12 12:59:44 -0400 |
commit | b73c78d88cde644745593a016b3d408e4435a785 (patch) | |
tree | 6bf434914e7d4f06cc145f0b291779193939380f /libpod/runtime_img.go | |
parent | ac96112d706ac7be682a6a3e218b10affd2ece20 (diff) | |
parent | 1c9753c2304eff158510ff005468587c6d8ad3ff (diff) | |
download | podman-b73c78d88cde644745593a016b3d408e4435a785.tar.gz podman-b73c78d88cde644745593a016b3d408e4435a785.tar.bz2 podman-b73c78d88cde644745593a016b3d408e4435a785.zip |
Merge pull request #7202 from baude/buildevent
add event for image build
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r-- | libpod/runtime_img.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index 4b5129f44..a95cd1d7a 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -17,6 +17,7 @@ import ( "github.com/containers/image/v5/oci/layout" "github.com/containers/image/v5/types" "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v2/libpod/events" "github.com/containers/podman/v2/libpod/image" "github.com/containers/podman/v2/pkg/util" "github.com/containers/storage" @@ -150,9 +151,21 @@ func removeStorageContainers(ctrIDs []string, store storage.Store) error { return nil } +// newBuildEvent creates a new event based on completion of a built image +func (r *Runtime) newImageBuildCompleteEvent(idOrName string) { + e := events.NewEvent(events.Build) + e.Type = events.Image + e.Name = idOrName + if err := r.eventer.Write(e); err != nil { + logrus.Errorf("unable to write build event: %q", err) + } +} + // Build adds the runtime to the imagebuildah call func (r *Runtime) Build(ctx context.Context, options imagebuildah.BuildOptions, dockerfiles ...string) (string, reference.Canonical, error) { id, ref, err := imagebuildah.BuildDockerfiles(ctx, r.store, options, dockerfiles...) + // Write event for build completion + r.newImageBuildCompleteEvent(id) return id, ref, err } |