summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/containers/attach.go14
-rw-r--r--pkg/bindings/images/build.go11
-rw-r--r--pkg/bindings/images/types.go4
-rw-r--r--pkg/bindings/images/types_export_options.go15
-rw-r--r--pkg/bindings/images/types_prune_options.go15
5 files changed, 48 insertions, 11 deletions
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go
index 6efbcb57b..abf58aaf9 100644
--- a/pkg/bindings/containers/attach.go
+++ b/pkg/bindings/containers/attach.go
@@ -102,7 +102,7 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
}
defer func() {
if err := terminal.Restore(int(file.Fd()), state); err != nil {
- logrus.Errorf("unable to restore terminal: %q", err)
+ logrus.Errorf("Unable to restore terminal: %q", err)
}
logrus.SetFormatter(&logrus.TextFormatter{})
}()
@@ -166,7 +166,7 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
_, err := utils.CopyDetachable(socket, stdin, detachKeysInBytes)
if err != nil && err != define.ErrDetach {
- logrus.Error("failed to write input to service: " + err.Error())
+ logrus.Errorf("Failed to write input to service: %v", err)
}
stdinChan <- err
@@ -349,7 +349,7 @@ func attachHandleResize(ctx, winCtx context.Context, winChange chan os.Signal, i
resize := func() {
w, h, err := terminal.GetSize(int(file.Fd()))
if err != nil {
- logrus.Warnf("failed to obtain TTY size: %v", err)
+ logrus.Warnf("Failed to obtain TTY size: %v", err)
}
var resizeErr error
@@ -359,7 +359,7 @@ func attachHandleResize(ctx, winCtx context.Context, winChange chan os.Signal, i
resizeErr = ResizeContainerTTY(ctx, id, new(ResizeTTYOptions).WithHeight(h).WithWidth(w))
}
if resizeErr != nil {
- logrus.Infof("failed to resize TTY: %v", resizeErr)
+ logrus.Infof("Failed to resize TTY: %v", resizeErr)
}
}
@@ -443,13 +443,13 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
}
defer func() {
if err := terminal.Restore(int(terminalFile.Fd()), state); err != nil {
- logrus.Errorf("unable to restore terminal: %q", err)
+ logrus.Errorf("Unable to restore terminal: %q", err)
}
logrus.SetFormatter(&logrus.TextFormatter{})
}()
w, h, err := terminal.GetSize(int(terminalFile.Fd()))
if err != nil {
- logrus.Warnf("failed to obtain TTY size: %v", err)
+ logrus.Warnf("Failed to obtain TTY size: %v", err)
}
body.Width = uint16(w)
body.Height = uint16(h)
@@ -502,7 +502,7 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
logrus.Debugf("Copying STDIN to socket")
_, err := utils.CopyDetachable(socket, options.InputStream, []byte{})
if err != nil {
- logrus.Error("failed to write input to service: " + err.Error())
+ logrus.Errorf("Failed to write input to service: %v", err)
}
if closeWrite, ok := socket.(CloseWriter); ok {
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 9d5aad23b..8cf4532d0 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -230,6 +230,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
params.Add("platform", platform)
}
}
+ if contextDir, err := filepath.EvalSymlinks(options.ContextDirectory); err == nil {
+ options.ContextDirectory = contextDir
+ }
params.Set("pullpolicy", options.PullPolicy.String())
@@ -312,7 +315,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
contextDir, err := filepath.Abs(options.ContextDirectory)
if err != nil {
- logrus.Errorf("cannot find absolute path of %v: %v", options.ContextDirectory, err)
+ logrus.Errorf("Cannot find absolute path of %v: %v", options.ContextDirectory, err)
return nil, err
}
@@ -339,7 +342,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
containerfile, err := filepath.Abs(c)
if err != nil {
- logrus.Errorf("cannot find absolute path of %v: %v", c, err)
+ logrus.Errorf("Cannot find absolute path of %v: %v", c, err)
return nil, err
}
@@ -371,7 +374,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
tarfile, err := nTar(append(excludes, dontexcludes...), tarContent...)
if err != nil {
- logrus.Errorf("cannot tar container entries %v error: %v", tarContent, err)
+ logrus.Errorf("Cannot tar container entries %v error: %v", tarContent, err)
return nil, err
}
defer func() {
@@ -477,7 +480,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
for _, src := range sources {
s, err := filepath.Abs(src)
if err != nil {
- logrus.Errorf("cannot stat one of source context: %v", err)
+ logrus.Errorf("Cannot stat one of source context: %v", err)
merr = multierror.Append(merr, err)
return
}
diff --git a/pkg/bindings/images/types.go b/pkg/bindings/images/types.go
index 801f5ed96..dc6bd91c3 100644
--- a/pkg/bindings/images/types.go
+++ b/pkg/bindings/images/types.go
@@ -65,6 +65,8 @@ type ExportOptions struct {
Compress *bool
// Format of the output
Format *string
+ // Accept uncompressed layers when copying OCI images.
+ OciAcceptUncompressedLayers *bool
}
//go:generate go run ../generator/generator.go PruneOptions
@@ -72,6 +74,8 @@ type ExportOptions struct {
type PruneOptions struct {
// Prune all images
All *bool
+ // Prune images even when they're used by external containers
+ External *bool
// Filters to apply when pruning images
Filters map[string][]string
}
diff --git a/pkg/bindings/images/types_export_options.go b/pkg/bindings/images/types_export_options.go
index 6229e435c..649b6814e 100644
--- a/pkg/bindings/images/types_export_options.go
+++ b/pkg/bindings/images/types_export_options.go
@@ -46,3 +46,18 @@ func (o *ExportOptions) GetFormat() string {
}
return *o.Format
}
+
+// WithOciAcceptUncompressedLayers set field OciAcceptUncompressedLayers to given value
+func (o *ExportOptions) WithOciAcceptUncompressedLayers(value bool) *ExportOptions {
+ o.OciAcceptUncompressedLayers = &value
+ return o
+}
+
+// GetOciAcceptUncompressedLayers returns value of field OciAcceptUncompressedLayers
+func (o *ExportOptions) GetOciAcceptUncompressedLayers() bool {
+ if o.OciAcceptUncompressedLayers == nil {
+ var z bool
+ return z
+ }
+ return *o.OciAcceptUncompressedLayers
+}
diff --git a/pkg/bindings/images/types_prune_options.go b/pkg/bindings/images/types_prune_options.go
index 77bef32e3..c9772045e 100644
--- a/pkg/bindings/images/types_prune_options.go
+++ b/pkg/bindings/images/types_prune_options.go
@@ -32,6 +32,21 @@ func (o *PruneOptions) GetAll() bool {
return *o.All
}
+// WithExternal set field External to given value
+func (o *PruneOptions) WithExternal(value bool) *PruneOptions {
+ o.External = &value
+ return o
+}
+
+// GetExternal returns value of field External
+func (o *PruneOptions) GetExternal() bool {
+ if o.External == nil {
+ var z bool
+ return z
+ }
+ return *o.External
+}
+
// WithFilters set field Filters to given value
func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions {
o.Filters = value