提交 06318f75 编写于 作者: J Jeff Zvier

parser: modify tips when no instruction found in Dockerfile

Signed-off-by: Nliuzekun <liuzekun@huawei.com>
上级 62baceea
......@@ -184,7 +184,7 @@ func getPageName(line *parser.Line, pageNum int) (string, error) {
func constructPages(lines []*parser.Line, onbuild bool) ([]*parser.Page, error) {
if len(lines) == 0 {
return nil, errors.New("dockerfile content is empty")
return nil, errors.New("no instructions in Dockerfile")
}
var (
......
......@@ -142,7 +142,7 @@ func TestParse(t *testing.T) {
{
name: "busybox_with_empty_content",
isErr: true,
errStr: "dockerfile content is empty",
errStr: "no instructions in Dockerfile",
},
{
name: "busybox_no_command",
......
......@@ -68,7 +68,7 @@ func (b *Backend) Build(req *pb.BuildRequest, stream pb.Control_BuildServer) (er
// the pipeFile, which will cause frontend hangs forever.
// so if the output type is archive(pipeFile is not empty string) and any error occurred, we write the error
// message into the pipe to make the goroutine move on instead of hangs.
if err != nil && pipeWrapper.PipeFile != "" {
if err != nil && pipeWrapper != nil {
pipeWrapper.Close()
if perr := ioutil.WriteFile(pipeWrapper.PipeFile, []byte(err.Error()), constant.DefaultRootFileMode); perr != nil {
logrus.WithField(util.LogKeySessionID, req.BuildID).Warnf("Write error [%v] in to pipe file failed: %v", err, perr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册