Skip to content

Commit

Permalink
Refactor API build endpoint to be more compliant
Browse files Browse the repository at this point in the history
* Refactor/Rename channel.WriteCloser() to encapsulate the channel
* Refactor build endpoint to "live" stream buildah output channels
  over API rather then buffering output
* Refactor bindings/tunnel build because endpoint changes
  * building tar file now in bindings rather then depending on
    caller
* Cleanup initiating extra image engine
* Remove setting fields to zero values (less noise in code)
* Update tests to support remote builds

Fixes #7136
Fixes #7137

Signed-off-by: Jhon Honce <[email protected]>
  • Loading branch information
jwhonce committed Sep 14, 2020
1 parent fd7cdb2 commit 146c68f
Show file tree
Hide file tree
Showing 15 changed files with 478 additions and 378 deletions.
9 changes: 2 additions & 7 deletions cmd/podman/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,9 @@ func build(cmd *cobra.Command, args []string) error {
}
}

ie, err := registry.NewImageEngine(cmd, args)
if err != nil {
return err
}

var logfile *os.File
if cmd.Flag("logfile").Changed {
logfile, err = os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
logfile, err := os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
if err != nil {
return errors.Errorf("error opening logfile %q: %v", buildOpts.Logfile, err)
}
Expand All @@ -225,7 +220,7 @@ func build(cmd *cobra.Command, args []string) error {
return err
}

_, err = ie.Build(registry.GetContext(), containerFiles, *apiBuildOpts)
_, err = registry.ImageEngine().Build(registry.GetContext(), containerFiles, *apiBuildOpts)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
pFlags.StringVar(&opts.RegistriesConf, "registries-conf", "", "Path to a registries.conf to use for image processing")
pFlags.StringVar(&opts.Runroot, "runroot", "", "Path to the 'run directory' where all state information is stored")
pFlags.StringVar(&opts.RuntimePath, "runtime", "", "Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc")
pFlags.StringArrayVar(&opts.RuntimeFlags, "runtime-flag", []string{}, "add global flags for the container runtime")
// -s is deprecated due to conflict with -s on subcommands
pFlags.StringVar(&opts.StorageDriver, "storage-driver", "", "Select which storage driver is used to manage storage of images and containers (default is overlay)")
pFlags.StringArrayVar(&opts.StorageOpts, "storage-opt", []string{}, "Used to pass an option to the storage driver")
Expand Down Expand Up @@ -301,6 +300,7 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {

// Only create these flags for ABI connections
if !registry.IsRemote() {
pFlags.StringArrayVar(&opts.RuntimeFlags, "runtime-flag", []string{}, "add global flags for the container runtime")
pFlags.BoolVar(&useSyslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
}
}
Expand Down
Loading

0 comments on commit 146c68f

Please sign in to comment.