1
0
mirror of https://github.com/containers/buildah.git synced 2025-07-30 04:23:09 +03:00

build-using-dockerfile: add --annotation

Add an --annotation flag to "buildah build-using-dockerfile".

Refactor the logic for --label handling to use SetLabel() to set them in
the image configuration in Executor.Commit(), instead of passing them as
a field in CommitOptions for Builder.Commit() and expecting it to do so.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #716
Approved by: rhatdan
This commit is contained in:
Nalin Dahyabhai
2018-05-22 12:05:18 -04:00
committed by Atomic Bot
parent c806e6e065
commit 71f0f9d063
7 changed files with 43 additions and 14 deletions

View File

@ -5,7 +5,6 @@ import (
"fmt"
"io"
"io/ioutil"
"strings"
"time"
cp "github.com/containers/image/copy"
@ -53,8 +52,6 @@ type CommitOptions struct {
// Squash tells the builder to produce an image with a single layer
// instead of with possibly more than one layer.
Squash bool
// Labels metadata for an image
Labels []string
}
// PushOptions can be used to alter how an image is copied somewhere.
@ -89,15 +86,6 @@ type PushOptions struct {
func (b *Builder) Commit(ctx context.Context, dest types.ImageReference, options CommitOptions) (string, error) {
var imgID string
for _, labelSpec := range options.Labels {
label := strings.SplitN(labelSpec, "=", 2)
if len(label) > 1 {
b.SetLabel(label[0], label[1])
} else {
b.SetLabel(label[0], "")
}
}
systemContext := getSystemContext(options.SystemContext, options.SignaturePolicyPath)
policy, err := signature.DefaultPolicy(systemContext)
if err != nil {