提交 df2c1730 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!50 Run: add linux capability for run command

Merge pull request !50 from holyfei/master
......@@ -75,7 +75,9 @@ type BuildRequest struct {
// encryptKey is key to encrypt items in buildArgs
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"`
AdditionalTag string `protobuf:"bytes,11,opt,name=additionalTag,proto3" json:"additionalTag,omitempty"`
// capAddList indicates Linux capabilities for RUN command
CapAddList []string `protobuf:"bytes,12,rep,name=capAddList,proto3" json:"capAddList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -182,6 +184,13 @@ func (m *BuildRequest) GetAdditionalTag() string {
return ""
}
func (m *BuildRequest) GetCapAddList() []string {
if m != nil {
return m.CapAddList
}
return nil
}
type ImportRequest struct {
// reference is reference of the import image
Reference string `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"`
......@@ -1524,94 +1533,95 @@ func init() {
func init() { proto.RegisterFile("api/services/control.proto", fileDescriptor_d71ef680555cb937) }
var fileDescriptor_d71ef680555cb937 = []byte{
// 1391 bytes of a gzipped FileDescriptorProto
// 1403 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x6d, 0x6f, 0xdb, 0xb6,
0x13, 0xff, 0xcb, 0x72, 0xec, 0xe4, 0x64, 0xbb, 0x01, 0xff, 0x45, 0x26, 0xb8, 0x69, 0xeb, 0x69,
0x13, 0xff, 0xcb, 0x72, 0x9c, 0xe4, 0xe4, 0xa4, 0x01, 0xff, 0x45, 0x26, 0xb8, 0x69, 0xeb, 0x69,
0xc5, 0xe0, 0x75, 0x80, 0x93, 0x66, 0x7d, 0x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 0x34, 0x06, 0x95, 0x40, 0xd9, 0x45, 0x54, 0xa9, 0x35, 0xab, 0x5d,
0x84, 0x46, 0x44, 0xff, 0x74, 0x71, 0xc8, 0x67, 0x17, 0xc5, 0x4f, 0xd7, 0x94, 0xf7, 0x03, 0x74,
0x7d, 0x12, 0xb1, 0x2b, 0x52, 0xa9, 0x93, 0xb2, 0xcc, 0xec, 0x6a, 0x99, 0x6d, 0x83, 0x8d, 0xc3,
0x50, 0x9b, 0xb5, 0xe9, 0xab, 0x63, 0xd6, 0x08, 0xd2, 0x98, 0x68, 0x63, 0x74, 0x23, 0x48, 0x63,
0x95, 0xf6, 0x5e, 0x7e, 0xa5, 0x71, 0xd8, 0x83, 0x4e, 0x88, 0x17, 0x84, 0xbf, 0x24, 0x42, 0x94,
0x15, 0xb0, 0x84, 0x79, 0x7f, 0x58, 0xf0, 0xff, 0xef, 0x08, 0x0e, 0xe5, 0xc5, 0xf1, 0x05, 0x99,
0x5d, 0x16, 0xba, 0x63, 0x68, 0x09, 0x5d, 0x9d, 0x5a, 0xab, 0x77, 0xf0, 0x60, 0x35, 0xfb, 0x6b,
0x94, 0x46, 0x67, 0xaa, 0x8f, 0xc7, 0x81, 0x29, 0x6b, 0x73, 0x81, 0xf7, 0x15, 0x74, 0x97, 0x18,
0xc8, 0x81, 0xf6, 0x8f, 0x93, 0xe7, 0x93, 0xd3, 0x9f, 0x26, 0xdb, 0xff, 0x53, 0xc4, 0xd9, 0x13,
0xff, 0xd5, 0x78, 0xf2, 0x6c, 0xdb, 0x42, 0x37, 0xc0, 0x99, 0x9c, 0x4e, 0x5f, 0xe7, 0x40, 0xc3,
0x4b, 0xa0, 0xf3, 0x82, 0x05, 0x34, 0xce, 0xc3, 0xb4, 0x03, 0x2d, 0x35, 0x2c, 0x08, 0x37, 0xce,
0x18, 0x0a, 0xf5, 0x61, 0x33, 0x15, 0x84, 0xc7, 0xea, 0x43, 0x64, 0x09, 0x2c, 0x68, 0xc5, 0x4b,
0xb0, 0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,
0xd1, 0x6d, 0xbe, 0x99, 0xb0, 0xfa, 0xbc, 0x69, 0x26, 0x6c, 0x7e, 0x36, 0x3c, 0x83, 0x4e, 0xd1,
0xc6, 0xd1, 0x32, 0xc1, 0x6a, 0x32, 0x34, 0x9d, 0x5b, 0xe8, 0xfe, 0x47, 0xd0, 0x56, 0x2d, 0x7c,
0x49, 0xb2, 0xaa, 0xde, 0xbf, 0x24, 0x59, 0xb5, 0xae, 0xbf, 0xe7, 0xa0, 0xe7, 0xd0, 0x29, 0x16,
0xe5, 0xa6, 0x35, 0x73, 0x3b, 0x78, 0xd3, 0x9a, 0xf9, 0xfd, 0x7a, 0xe0, 0xec, 0x39, 0xe8, 0x11,
0xb8, 0x6a, 0xbf, 0xef, 0x2d, 0x8a, 0x56, 0xab, 0x65, 0xef, 0x9a, 0x04, 0x28, 0x67, 0xd4, 0x70,
0x68, 0x3a, 0x53, 0x9b, 0x41, 0x4d, 0x67, 0xea, 0xf3, 0x64, 0xcf, 0x41, 0x5f, 0x43, 0x5b, 0xff,
0xfd, 0xeb, 0xb2, 0xdc, 0xd0, 0xaf, 0x77, 0xb9, 0x37, 0x1d, 0x2d, 0xfd, 0xc5, 0xbf, 0x01, 0x00,
0x00, 0xff, 0xff, 0x85, 0xc5, 0x39, 0xca, 0x7f, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -69,6 +69,8 @@ message BuildRequest {
string encryptKey = 10;
// additionalTag is the tag applied to the built image
string additionalTag = 11;
// capAddList indicates Linux capabilities for RUN command
repeated string capAddList = 12;
}
message ImportRequest {
......
......@@ -49,6 +49,7 @@ type BuildOptions struct {
File string
Iidfile string
Output []string
CapAddList []string
ProxyFlag bool
Tag string
AdditionalTag string
......@@ -98,10 +99,17 @@ func NewBuilder(ctx context.Context, store store.Store, req *pb.BuildRequest, ru
return nil, errors.Wrap(err, "parse build-arg failed")
}
for _, c := range req.GetCapAddList() {
if !util.CheckCap(c) {
return nil, errors.Errorf("cap %v is invalid", c)
}
}
b.buildOpts = BuildOptions{
ContextDir: req.GetContextDir(),
File: req.GetFileContent(),
BuildArgs: args,
CapAddList: req.GetCapAddList(),
ProxyFlag: req.GetProxy(),
Iidfile: req.GetIidfile(),
}
......
......@@ -131,6 +131,13 @@ func (c *cmdBuilder) setupRuntimeSpec(command []string) (*specs.Spec, error) {
g.AddLinuxReadonlyPaths(rp)
}
// add capability
for _, cap := range c.stage.builder.buildOpts.CapAddList {
if aerr := g.AddProcessCapability(cap); aerr != nil {
return nil, errors.Wrapf(aerr, "runner: add process capability %v failed", cap)
}
}
return g.Config, nil
}
......
......@@ -130,7 +130,8 @@ func TestSetupRuntimeSpec(t *testing.T) {
sb := &stageBuilder{
builder: &Builder{
buildOpts: BuildOptions{
ProxyFlag: true,
ProxyFlag: true,
CapAddList: []string{"CAP_SYS_ADMIN", "CAP_SYS_PTRACE"},
},
},
mountpoint: "/isulatest/mountpoint",
......@@ -167,6 +168,84 @@ func TestSetupRuntimeSpec(t *testing.T) {
assert.Equal(t, spec.Linux.ReadonlyPaths[0], "/proc/asound")
}
func TestSetupRuntimeSpecWithCaps(t *testing.T) {
sb := &stageBuilder{
builder: &Builder{
buildOpts: BuildOptions{},
},
docker: &docker.Image{
V1Image: docker.V1Image{
Config: &docker.Config{},
},
},
}
cb := newCmdBuilder(context.Background(), &parser.Line{}, sb, nil, nil)
tests := []struct {
name string
caps []string
isErr bool
}{
{
name: "1 cap null",
caps: []string{},
},
{
name: "2 cap valid 1",
caps: []string{"CAP_SYS_ADMIN"},
},
{
name: "3 cap valid 2",
caps: []string{"CAP_SYS_ADMIN", "CAP_CHOWN"},
},
{
name: "4 cap invalid 1",
caps: []string{"CAP_weeq", "CAP_CHOWN"},
isErr: true,
},
{
name: "5 cap invalid 2",
caps: []string{"CAP_ffffff", "CAP_CHOWNkkkk123"},
isErr: true,
},
{
name: "6 cap invalid 3",
caps: []string{"CAP_SYS_ADMINsss", "CAP_CHOWN123"},
isErr: true,
},
{
name: "7 cap invalid 4",
caps: []string{"12345"},
isErr: true,
},
{
name: "8 cap invalid 5",
caps: []string{"cap_sys"},
isErr: true,
},
{
name: "9 cap invalid 6",
caps: []string{"sys_admin"},
isErr: true,
},
{
name: "10 cap invalid 7",
caps: []string{" "},
isErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cb.stage.builder.buildOpts.CapAddList = tt.caps
_, err := cb.setupRuntimeSpec(nil)
if tt.isErr {
assert.ErrorContains(t, err, "failed")
}
})
}
}
func contains(envs []string, env string) bool {
for _, i := range envs {
if i == env {
......
......@@ -44,6 +44,7 @@ type buildOptions struct {
file string
output string
buildArgs []string
capAddList []string
encryptKey string
contextDir string
buildID string
......@@ -110,6 +111,7 @@ func NewBuildCmd() *cobra.Command {
buildCmd.PersistentFlags().BoolVarP(&buildOpts.proxyFlag, "proxy", "", true, "Inherit proxy environment variables from host")
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().StringArrayVar(&buildOpts.capAddList, "cap-add", []string{}, "Add Linux capabilities for RUN command")
buildCmd.PersistentFlags().StringVar(&buildOpts.imageIDFile, "iidfile", "", "Write image ID to the file")
buildCmd.PersistentFlags().StringVarP(&buildOpts.additionalTag, "tag", "", "", "Add tag to the built image")
......@@ -271,6 +273,12 @@ func runBuild(ctx context.Context, cli Cli) (string, error) {
imageIDFilePath string
)
for _, c := range buildOpts.capAddList {
if !util.CheckCap(c) {
return "", errors.Errorf("cap %v is invalid", c)
}
}
if dest, isIsulad, err = checkAndProcessOutput(); err != nil {
return "", err
}
......@@ -295,6 +303,7 @@ func runBuild(ctx context.Context, cli Cli) (string, error) {
BuildType: constant.BuildContainerImageType,
BuildID: buildOpts.buildID,
BuildArgs: buildOpts.buildArgs,
CapAddList: buildOpts.capAddList,
EncryptKey: buildOpts.encryptKey,
ContextDir: buildOpts.contextDir,
FileContent: content,
......
......@@ -559,3 +559,60 @@ func TestGetAbsPath(t *testing.T) {
})
}
}
func TestRunBuildWithCap(t *testing.T) {
tests := []struct {
name string
caps []string
isErr bool
wantErr bool
}{
{
name: "1 cap null",
caps: []string{},
},
{
name: "2 cap valid 1",
caps: []string{"CAP_SYS_ADMIN"},
},
{
name: "3 cap valid 2",
caps: []string{"CAP_SYS_ADMIN", "CAP_CHOWN"},
},
{
name: "4 cap invalid 1",
caps: []string{"CAP_SYS_ADMINsss", "CAP_CHOWN"},
isErr: true,
},
{
name: "5 cap invalid 2",
caps: []string{"CAP_SY2123", "CAP_CHOWN"},
isErr: true,
},
{
name: "6 cap invalid 3",
caps: []string{"CAP_SYS_ADMINsss", "CAP_CHOWN123"},
isErr: true,
},
}
dockerfile := `
FROM busybox:latest
RUN echo hello world
`
tmpDir := fs.NewDir(t, t.Name(), fs.WithFile("Dockerfile", dockerfile))
defer tmpDir.Remove()
buildOpts.file = tmpDir.Join("Dockerfile")
mockBuild := newMockDaemon()
ctx := context.Background()
cli := newMockClient(&mockGrpcClient{imageBuildFunc: mockBuild.build})
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
buildOpts.capAddList = tt.caps
_, err := runBuild(ctx, &cli)
if tt.isErr {
assert.ErrorContains(t, err, "is invalid")
}
})
}
}
......@@ -55,11 +55,11 @@ func TestRunSave(t *testing.T) {
wantErr: true,
},
{
name: "TC3 - normal case with relative path",
path: fmt.Sprintf("./%s", tmpDir.Path()),
args: []string{"testImage"},
name: "TC3 - normal case with relative path",
path: fmt.Sprintf("./%s", tmpDir.Path()),
args: []string{"testImage"},
// err here because cli will try to remove saved tar and it found there is no file to remove
wantErr: true,
wantErr: true,
errString: "save image failed",
},
{
......
......@@ -14,6 +14,7 @@
* [-o, --output](#-o---output)
* [--proxy](#--proxy)
* [--tag](#--tag)
* [--cap-add](#--cap-add)
* [Viewing a Local Persistent Image](#viewing-a-local-persistent-image)
* [Importing a Base Image from a Tarball](#importing-a-base-image-from-a-tarball)
* [Saving a Local Persistent Image](#saving-a-local-persistent-image)
......@@ -111,6 +112,7 @@ The build contains the following flags:
- -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
- --cap-add: string slice, which is added in RUN command during the build process
#### --build-arg
......@@ -215,6 +217,14 @@ Usage:
`isula-build ctr-img build --tag busybox:latest`
#### --cap-add
add Linux capabilities for RUN command
Usage:
`isula-build ctr-img build --cap-add CAP_SYS_ADMIN `
### Viewing a Local Persistent Image
We can run the images command to view the image stored locally.
......
// Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
// isula-build licensed under the Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v2 for more details.
// Author: Feiyu Yang
// Create: 2020-08-15
// Description: This file provides check func for linux capability.
package util
import (
"strings"
"github.com/syndtr/gocapability/capability"
)
var caps map[string]capability.Cap
func init() {
caps = make(map[string]capability.Cap)
for _, c := range capability.List() {
caps["CAP_"+strings.ToUpper(c.String())] = c
}
}
// CheckCap checks if cap is valid
func CheckCap(c string) bool {
_, ok := caps[c]
return ok
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册