Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
isula-build
提交
5a59b798
I
isula-build
项目概览
openeuler
/
isula-build
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
isula-build
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5a59b798
编写于
8月 12, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
8月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
!41 bugfix: fix review suggestions
Merge pull request !41 from DCCooper/review
上级
640e998f
64d4ad3b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
171 deletion
+17
-171
daemon/save.go
daemon/save.go
+17
-6
hack/isula_build.bash
hack/isula_build.bash
+0
-165
未找到文件。
daemon/save.go
浏览文件 @
5a59b798
...
...
@@ -36,8 +36,6 @@ import (
func
(
b
*
Backend
)
Save
(
req
*
pb
.
SaveRequest
,
stream
pb
.
Control_SaveServer
)
(
err
error
)
{
// nolint:gocyclo
const
exportType
=
"docker-archive"
var
(
f
*
os
.
File
length
int
pipeWrapper
*
exporter
.
PipeWrapper
imageInfo
=
req
.
Image
saveID
=
req
.
SaveID
...
...
@@ -96,8 +94,11 @@ func (b *Backend) Save(req *pb.SaveRequest, stream pb.Control_SaveServer) (err e
})
eg
.
Go
(
func
()
error
{
f
,
err
=
exporter
.
PipeArchiveStream
(
pipeWrapper
)
if
err
!=
nil
{
var
(
f
*
os
.
File
length
int
)
if
f
,
err
=
exporter
.
PipeArchiveStream
(
pipeWrapper
);
err
!=
nil
{
return
err
}
defer
func
()
{
...
...
@@ -144,8 +145,14 @@ func (b *Backend) Save(req *pb.SaveRequest, stream pb.Control_SaveServer) (err e
errC
<-
eg
.
Wait
()
}()
var
ok
bool
select
{
case
err
=
<-
errC
:
case
err
,
ok
=
<-
errC
:
if
!
ok
{
logrus
.
WithField
(
util
.
LogKeySessionID
,
saveID
)
.
Warn
(
"Channel errC closed"
)
return
nil
}
close
(
errC
)
if
err
!=
nil
{
return
err
...
...
@@ -154,7 +161,11 @@ func (b *Backend) Save(req *pb.SaveRequest, stream pb.Control_SaveServer) (err e
if
err
=
stream
.
Send
(
&
pb
.
SaveResponse
{
Data
:
nil
});
err
!=
nil
{
return
err
}
case
<-
stream
.
Context
()
.
Done
()
:
case
_
,
ok
=
<-
stream
.
Context
()
.
Done
()
:
if
!
ok
{
logrus
.
WithField
(
util
.
LogKeySessionID
,
saveID
)
.
Warn
(
"Channel stream done closed"
)
return
nil
}
err
=
egCtx
.
Err
()
if
err
!=
nil
&&
err
!=
context
.
Canceled
{
logrus
.
WithField
(
util
.
LogKeySessionID
,
saveID
)
.
Warnf
(
"Stream closed with: %v"
,
err
)
...
...
hack/isula_build.bash
已删除
100755 → 0
浏览文件 @
640e998f
#!/usr/bin/env bash
# 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: Xiang Li
# Create: 2020-07-01
# Description: bash completion file for isula-build commands
# To enable the completions, place this file in "/etc/bash_completion.d/"
# or just "source isula-build.bash" for temporary use
# completion for "isula-build"
_isula_build
()
{
local
index
=
1 cmd
local
first_class_commands
=
"ctr-img login logout help version"
local
global_flags
=
"--version --help --debug -log-level --timeout"
while
[[
"
${
index
}
"
-lt
"
${
COMP_CWORD
}
"
]]
;
do
local
s
=
"
${
COMP_WORDS
[index]
}
"
case
"
${
s
}
"
in
-
*
)
;;
*
)
cmd
=
"
${
s
}
"
break
;;
esac
((
index++
))
done
if
[[
"
${
index
}
"
-eq
"
${
COMP_CWORD
}
"
]]
;
then
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
COMPREPLY
=(
$(
compgen
-W
"
${
first_class_commands
}
${
global_flags
}
"
--
"
${
cur
}
"
)
)
return
fi
case
"
${
cmd
}
"
in
ctr-img
)
_isula_build_ctr_img
;;
login
)
_isula_build_login
;;
logout
)
_isula_build_logout
;;
esac
}
# complete for command "ctr-img"
_isula_build_ctr_img
()
{
local
index
=
1 subcommand_index
while
[[
"
${
index
}
"
-lt
${
COMP_CWORD
}
]]
;
do
local
s
=
"
${
COMP_WORDS
[index]
}
"
case
"
${
s
}
"
in
ctr-img
)
subcommand_index
=
${
index
}
break
;;
esac
((
index++
))
done
while
[[
${
subcommand_index
}
-lt
${
COMP_CWORD
}
]]
;
do
local
s
=
"
${
COMP_WORDS
[subcommand_index]
}
"
case
"
${
s
}
"
in
build
)
_isula_build_ctr_img_build
return
;;
images
)
_isula_build_ctr_img_images
return
;;
rm
)
_isula_build_ctr_img_rm
return
;;
help
|
-h
)
COMPREPLY
=()
return
;;
esac
((
subcommand_index++
))
done
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
COMPREPLY
=(
$(
compgen
-W
"build images rm help"
--
"
${
cur
}
"
)
)
}
_isula_build_ctr_img_build
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
local
prev
=
"
${
COMP_WORDS
[COMP_CWORD-1]
}
"
case
${
prev
}
in
'--filename'
|
'--iidfile'
)
COMPREPLY
=(
$(
compgen
-f
--
"
${
cur
}
"
)
)
return
;;
'--build-arg'
|
'--build-static'
|
'--output'
|
'--proxy'
|
'--help'
)
return
;;
esac
COMPREPLY
=(
$(
compgen
-W
"--build-arg --build-static --filename --iidfile --output --proxy --help"
--
"
${
cur
}
"
)
)
}
_isula_build_ctr_img_rm
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
local
prev
=
"
${
COMP_WORDS
[COMP_CWORD-1]
}
"
case
${
prev
}
in
-
*
)
return
;;
esac
COMPREPLY
=(
$(
compgen
-W
"--all --help"
--
"
${
cur
}
"
)
)
}
_isula_build_ctr_img_images
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
local
prev
=
"
${
COMP_WORDS
[COMP_CWORD-1]
}
"
case
${
prev
}
in
-
*
)
return
;;
esac
COMPREPLY
=(
$(
compgen
-W
"--help"
--
"
${
cur
}
"
)
)
}
_isula_build_login
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
COMPREPLY
=(
$(
compgen
-W
"--username --password-stdin --help"
--
"
${
cur
}
"
)
)
}
_isula_build_logout
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
local
prev
=
"
${
COMP_WORDS
[COMP_CWORD-1]
}
"
case
${
prev
}
in
-
*
)
return
;;
esac
COMPREPLY
=(
$(
compgen
-W
"--all --help"
--
"
${
cur
}
"
)
)
}
# completion for "isula-builder"
_isula_builder
()
{
local
cur
=
"
${
COMP_WORDS
[COMP_CWORD]
}
"
local
prev
=
"
${
COMP_WORDS
[COMP_CWORD-1]
}
"
COMPREPLY
=()
case
${
prev
}
in
'-v'
|
'--version'
|
'-h'
|
'--help'
|
'-D'
|
'--debug'
)
return
0
;;
'-c'
|
'--config'
)
COMPREPLY
=(
$(
compgen
-f
--
"
${
cur
}
"
)
)
return
0
;;
'--dataroot'
|
'--runroot'
)
COMPREPLY
=(
$(
compgen
-d
--
"
${
cur
}
"
)
)
return
0
;;
esac
local
OPTS
=
"--config --dataroot --debug --help --log-level --runroot --storage-driver --storage-opt --version"
COMPREPLY
=(
$(
compgen
-W
"
${
OPTS
[*]
}
"
--
"
${
cur
}
"
)
)
}
complete
-F
_isula_build isula-build
complete
-F
_isula_builder isula-builder
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录