提交 2d5c4274 编写于 作者: X xiadanni

isula-build: add --tag flag to tag the built image

Signed-off-by: Nxiadanni <xiadanni1@huawei.com>
上级 955cd89b
......@@ -73,7 +73,9 @@ type BuildRequest struct {
// buildStatic is used to hold the options for static build
BuildStatic *BuildStatic `protobuf:"bytes,9,opt,name=buildStatic,proto3" json:"buildStatic,omitempty"`
// encryptKey is key to encrypt items in buildArgs
EncryptKey string `protobuf:"bytes,10,opt,name=encryptKey,proto3" json:"encryptKey,omitempty"`
EncryptKey string `protobuf:"bytes,10,opt,name=encryptKey,proto3" json:"encryptKey,omitempty"`
// additionalTag is the tag applied to the built image
AdditionalTag string `protobuf:"bytes,11,opt,name=additionalTag,proto3" json:"additionalTag,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -173,6 +175,13 @@ func (m *BuildRequest) GetEncryptKey() string {
return ""
}
func (m *BuildRequest) GetAdditionalTag() string {
if m != nil {
return m.AdditionalTag
}
return ""
}
type ImportRequest struct {
// reference is reference of the import image
Reference string `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"`
......@@ -1080,69 +1089,70 @@ func init() {
func init() { proto.RegisterFile("api/services/control.proto", fileDescriptor_d71ef680555cb937) }
var fileDescriptor_d71ef680555cb937 = []byte{
// 986 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x5b, 0x6f, 0xe3, 0xc4,
0x17, 0xff, 0x3b, 0x17, 0xa7, 0x3d, 0x4e, 0xb2, 0xd5, 0xfc, 0x51, 0x65, 0xa5, 0x65, 0x37, 0x18,
0x09, 0x05, 0x90, 0xdc, 0xdd, 0xc0, 0x03, 0x20, 0x2d, 0x52, 0x2f, 0x4b, 0x09, 0x5b, 0xb2, 0xc2,
0x2d, 0xcb, 0x23, 0x9a, 0x26, 0xd3, 0x74, 0xb4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0xff, 0xeb, 0x46, 0x9c, 0xd1, 0xfc, 0x09, 0x00, 0x00,
// 1005 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xeb, 0x6e, 0xe3, 0x44,
0x14, 0xc6, 0x4d, 0xe3, 0xb4, 0xc7, 0x49, 0xb6, 0x1a, 0x50, 0x65, 0x65, 0xcb, 0x6e, 0x30, 0x08,
0x05, 0x90, 0xdc, 0xdd, 0xc0, 0x0f, 0x40, 0x5a, 0xa4, 0x5e, 0x96, 0x12, 0xb6, 0x64, 0x85, 0x5b,
0x96, 0x9f, 0x68, 0x9a, 0x4c, 0xdd, 0xd1, 0xda, 0x1e, 0x33, 0x33, 0x2e, 0x1b, 0x78, 0x15, 0x78,
0x22, 0x1e, 0x80, 0x07, 0xe1, 0x05, 0xd0, 0x8c, 0xc7, 0xb7, 0x38, 0xa5, 0xfb, 0x6f, 0xce, 0x65,
0xce, 0x9c, 0xcb, 0xf7, 0x1d, 0x1b, 0x46, 0x38, 0xa5, 0x87, 0x82, 0xf0, 0x5b, 0xba, 0x20, 0xe2,
0x70, 0xc1, 0x12, 0xc9, 0x59, 0xe4, 0xa7, 0x9c, 0x49, 0x86, 0x86, 0x54, 0x64, 0x11, 0xf6, 0xaf,
0x32, 0x1a, 0x2d, 0xfd, 0xdb, 0xa7, 0xa3, 0x87, 0x21, 0x63, 0x61, 0x44, 0x0e, 0xb5, 0xf5, 0x2a,
0xbb, 0x3e, 0x24, 0x71, 0x2a, 0x57, 0xb9, 0xf3, 0xe8, 0xf1, 0xba, 0x51, 0xd2, 0x98, 0x08, 0x89,
0xe3, 0x34, 0x77, 0xf0, 0xfe, 0xdd, 0x82, 0xfe, 0xb1, 0x0a, 0x15, 0x90, 0x5f, 0x33, 0x22, 0x24,
0x3a, 0x80, 0x5d, 0x1d, 0xfa, 0x72, 0x95, 0x12, 0xd7, 0x1a, 0x5b, 0x93, 0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 0x15,
0x35, 0x09, 0xf8, 0xc4, 0x42, 0xdf, 0x83, 0x53, 0x23, 0xca, 0x9d, 0x29, 0x7d, 0xf8, 0x16, 0xec,
0x42, 0xa7, 0xd0, 0xd5, 0xc8, 0x6c, 0x0f, 0xac, 0x4e, 0x91, 0xf6, 0xc0, 0x9a, 0x70, 0x3e, 0x03,
0x3b, 0x47, 0x1e, 0xda, 0xe4, 0x58, 0x81, 0xb9, 0x5d, 0xdc, 0x1a, 0x60, 0xd5, 0xb0, 0x18, 0x5e,
0x6e, 0x18, 0x56, 0x05, 0xd7, 0x0d, 0xc3, 0xaa, 0x03, 0x75, 0x06, 0x76, 0xfe, 0xad, 0x6e, 0xe7,
0xd2, 0xf8, 0x0d, 0x68, 0xe7, 0xd2, 0xfc, 0xc4, 0x4f, 0xac, 0x2b, 0x5b, 0x77, 0xf4, 0xf3, 0xff,
0x02, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x22, 0xc1, 0x44, 0x22, 0x0a, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -61,6 +61,8 @@ message BuildRequest {
BuildStatic buildStatic = 9;
// encryptKey is key to encrypt items in buildArgs
string encryptKey = 10;
// additionalTag is the tag applied to the built image
string additionalTag = 11;
}
message ImportRequest {
......
......@@ -26,6 +26,7 @@ import (
"strings"
"time"
"github.com/containers/image/v5/docker/reference"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
......@@ -43,13 +44,14 @@ import (
// BuildOptions is the option for build an image
type BuildOptions struct {
BuildArgs map[string]string
ContextDir string
File string
Iidfile string
Output []string
ProxyFlag bool
Tag string
BuildArgs map[string]string
ContextDir string
File string
Iidfile string
Output []string
ProxyFlag bool
Tag string
AdditionalTag string
}
// Builder is the object to build a Dockerfile
......@@ -104,14 +106,8 @@ func NewBuilder(ctx context.Context, store store.Store, req *pb.BuildRequest, ru
Iidfile: req.GetIidfile(),
}
b.parseStaticBuildOpts(req)
tag := parseTag(req.Output)
if tag != "" {
candidates, _, rerr := image.ResolveName(tag, nil, b.localStore)
if rerr != nil || len(candidates) == 0 {
return nil, errors.Wrapf(rerr, "parse target tag %v err", tag)
}
b.buildOpts.Tag = candidates[0]
if err = b.parseTag(req.Output, req.AdditionalTag); err != nil {
return nil, err
}
// prepare workdirs for dockerfile builder
......@@ -137,6 +133,23 @@ func NewBuilder(ctx context.Context, store store.Store, req *pb.BuildRequest, ru
return b, nil
}
func (b *Builder) parseTag(output, additionalTag string) error {
var err error
if tag := parseOutputTag(output); tag != "" {
if b.buildOpts.Tag, err = expandTag(tag, b.localStore); err != nil {
return err
}
}
if additionalTag != "" {
if b.buildOpts.AdditionalTag, err = expandTag(additionalTag, b.localStore); err != nil {
return err
}
}
return nil
}
func (b *Builder) parseOutput(output string) error {
var (
pipeWrapper *exporter.PipeWrapper
......@@ -458,11 +471,10 @@ func (b *Builder) cleanup() {
func (b *Builder) export(imageID string) error {
exportTimer := b.cliLog.StartTimer("EXPORT")
if b.buildOpts.Tag != "" {
if serr := b.localStore.SetNames(imageID, []string{b.buildOpts.Tag}); serr != nil {
return errors.Wrap(serr, "set tag for image error")
}
if err := b.applyTag(imageID); err != nil {
return err
}
var retErr error
for _, o := range b.buildOpts.Output {
exOpts := exporter.ExportOptions{
......@@ -482,6 +494,24 @@ func (b *Builder) export(imageID string) error {
return retErr
}
func (b *Builder) applyTag(imageID string) error {
tags := make([]string, 0, 0)
if b.buildOpts.Tag != "" {
tags = append(tags, b.buildOpts.Tag)
}
if b.buildOpts.AdditionalTag != "" {
tags = append(tags, b.buildOpts.AdditionalTag)
}
if len(tags) > 0 {
if serr := b.localStore.SetNames(imageID, tags); serr != nil {
return errors.Wrapf(serr, "set tags %v for image %v error", tags, imageID)
}
}
return nil
}
func (b *Builder) writeImageID(imageID string) error {
if b.buildOpts.Iidfile != "" {
if err := ioutil.WriteFile(b.buildOpts.Iidfile, []byte(imageID), constant.DefaultRootFileMode); err != nil {
......@@ -517,7 +547,7 @@ func (b *Builder) OutputPipeWrapper() *exporter.PipeWrapper {
return b.pipeWrapper
}
func parseTag(output string) string {
func parseOutputTag(output string) string {
outputFields := strings.Split(output, ":")
const archiveOutputWithoutTagLen = 2
......@@ -526,9 +556,6 @@ func parseTag(output string) string {
case (outputFields[0] == "docker-daemon" || outputFields[0] == "isulad") && len(outputFields) > 1:
tag = strings.Join(outputFields[1:], ":")
case outputFields[0] == "docker-archive" && len(outputFields) > archiveOutputWithoutTagLen:
if len(outputFields[archiveOutputWithoutTagLen:]) == 1 {
outputFields = append(outputFields, "latest")
}
tag = strings.Join(outputFields[archiveOutputWithoutTagLen:], ":")
case outputFields[0] == "docker" && len(outputFields) > 1:
repoAndTag := strings.Join(outputFields[1:], ":")
......@@ -538,10 +565,24 @@ func parseTag(output string) string {
return ""
}
tag = repoAndTag[len(repo):]
if len(strings.Split(tag, ":")) == 1 {
tag += ":latest"
}
}
return tag
}
// expandTag resolves tag name, if it not include a domain, "localhost" will be
// added, and if it not include a tag, "latest" will be added.
func expandTag(tag string, store store.Store) (string, error) {
candidates, _, err := image.ResolveName(tag, nil, store)
if err != nil || len(candidates) == 0 {
return "", errors.Errorf("resolve tag %v err: %v", tag, err)
}
tagNamed, err := reference.ParseNormalizedNamed(candidates[0])
if err != nil {
return "", errors.Wrapf(err, "parse tag %v err", candidates[0])
}
tagNamed = reference.TagNameOnly(tagNamed)
return tagNamed.String(), nil
}
......@@ -1288,7 +1288,7 @@ func TestParseTag(t *testing.T) {
{
name: "docker-archive output only with name",
output: "docker-archive:./isula.tar:isula",
tag: "isula:latest",
tag: "isula",
},
{
name: "docker output",
......@@ -1298,7 +1298,7 @@ func TestParseTag(t *testing.T) {
{
name: "docker output",
output: "docker://localhost:5000/isula/test",
tag: "isula/test:latest",
tag: "isula/test",
},
{
name: "invalid docker output",
......@@ -1307,7 +1307,7 @@ func TestParseTag(t *testing.T) {
},
}
for _, tc := range testcases {
tag := parseTag(tc.output)
tag := parseOutputTag(tc.output)
assert.Equal(t, tag, tc.tag, tc.name)
}
}
......
......@@ -41,15 +41,16 @@ import (
)
type buildOptions struct {
file string
output string
buildArgs []string
encryptKey string
contextDir string
buildID string
proxyFlag bool
buildStatic opts.ListOpts
imageIDFile string
file string
output string
buildArgs []string
encryptKey string
contextDir string
buildID string
proxyFlag bool
buildStatic opts.ListOpts
imageIDFile string
additionalTag string
}
type staticBuildMode string
......@@ -106,6 +107,7 @@ func NewBuildCmd() *cobra.Command {
buildCmd.PersistentFlags().VarP(&buildOpts.buildStatic, "build-static", "", "Static build with the given option")
buildCmd.PersistentFlags().StringArrayVar(&buildOpts.buildArgs, "build-arg", []string{}, "Arguments used during build time")
buildCmd.PersistentFlags().StringVar(&buildOpts.imageIDFile, "iidfile", "", "Write image ID to the file")
buildCmd.PersistentFlags().StringVarP(&buildOpts.additionalTag, "tag", "", "", "Add tag to the built image")
return buildCmd
}
......@@ -277,16 +279,17 @@ func runBuild(ctx context.Context, cli Cli) (string, error) {
}
budStream, err := cli.Client().Build(ctx, &pb.BuildRequest{
BuildType: constant.BuildContainerImageType,
BuildID: buildOpts.buildID,
BuildArgs: buildOpts.buildArgs,
EncryptKey: buildOpts.encryptKey,
ContextDir: buildOpts.contextDir,
FileContent: content,
Output: buildOpts.output,
Proxy: buildOpts.proxyFlag,
BuildStatic: buildStatic,
Iidfile: buildOpts.imageIDFile,
BuildType: constant.BuildContainerImageType,
BuildID: buildOpts.buildID,
BuildArgs: buildOpts.buildArgs,
EncryptKey: buildOpts.encryptKey,
ContextDir: buildOpts.contextDir,
FileContent: content,
Output: buildOpts.output,
Proxy: buildOpts.proxyFlag,
BuildStatic: buildStatic,
Iidfile: buildOpts.imageIDFile,
AdditionalTag: buildOpts.additionalTag,
})
if err != nil {
return "", err
......
......@@ -39,10 +39,10 @@ func (b *Backend) List(ctx context.Context, req *pb.ListRequest) (*pb.ListRespon
imageName := req.ImageName
reqRepository, reqTag := imageName, ""
const imageFieldLen = 2
parts := strings.SplitN(imageName, ":", imageFieldLen)
if len(parts) == imageFieldLen {
reqRepository, reqTag = parts[0], parts[1]
const minImageFieldLenWithTag = 2
parts := strings.Split(imageName, ":")
if len(parts) >= minImageFieldLenWithTag {
reqRepository, reqTag = strings.Join(parts[0:len(parts)-1], ":"), parts[len(parts)-1]
}
images, err := b.daemon.localStore.Images()
......@@ -58,9 +58,9 @@ func (b *Backend) List(ctx context.Context, req *pb.ListRequest) (*pb.ListRespon
}
for _, name := range names {
repository, tag := name, none
parts := strings.SplitN(name, ":", imageFieldLen)
if len(parts) == imageFieldLen {
repository, tag = parts[0], parts[1]
parts := strings.Split(name, ":")
if len(parts) >= minImageFieldLenWithTag {
repository, tag = strings.Join(parts[0:len(parts)-1], ":"), parts[len(parts)-1]
}
if reqRepository != "" && reqRepository != repository {
continue
......
......@@ -75,10 +75,11 @@ The build contains the following flags:
- --build-arg: string slice, which is used during the build process
- --build-static: string slice. Build binary equivalence. If this parameter is set, all timestamp differences and other build process differences (including the container ID and host name) will be eliminated, and a container image that meets BE requirements will be built.
- -f, --filename:string: indicates the path of the Dockerfile. If this parameter is not specified, the Dockerfile in the current path is used
- --iidfile:string, output image ID to the local file
- -o, --output:string: specifies the image export mode and path
- -f, --filename: string, indicates the path of the Dockerfile. If this parameter is not specified, the Dockerfile in the current path is used
- --iidfile: string, output image ID to the local file
- -o, --output: string, specifies the image export mode and path
- --proxy: bool, which inherits the proxy environment variable on the host side. The default value is true
- --tag: string, add tag to the built image
#### --build-arg
......@@ -175,6 +176,14 @@ In addition, the command line of the build subcommand also receives an argument(
Indicates whether the container started by running the RUN command inherits the proxy environment variable "http_proxy","https_proxy","ftp_proxy","no_proxy","HTTP_PROXY","HTTPS_PROXY","FTP_PROXY","NO_PROXY". The default value is true.
#### --tag
add tag to the built image
Usage:
`isula-build ctr-img build --tag busybox:latest`
### Viewing a Local Persistent Image
We can run the images command to view the image stored locally.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册