Commit 359ba611 authored by Kamil Trzciński's avatar Kamil Trzciński
Browse files

Lack of files for artifacts do a regular error

parent 0a096cff
......@@ -65,6 +65,10 @@ func (c *ArtifactsUploaderCommand) generateGzipStream(w *io.PipeWriter) {
}
func (c *ArtifactsUploaderCommand) createReadStream() (string, io.ReadCloser, error) {
if len(c.files) == 0 {
return "", nil, nil
}
switch c.Format {
case common.ArtifactFormatZip, "":
pr, pw := io.Pipe()
......@@ -72,10 +76,6 @@ func (c *ArtifactsUploaderCommand) createReadStream() (string, io.ReadCloser, er
return path.Base(c.Name) + ".zip", pr, nil
case common.ArtifactFormatGzip:
if len(c.files) == 0 {
return "", nil, errors.New("no file to upload")
}
pr, pw := io.Pipe()
go c.generateGzipStream(pw)
return c.Name + ".gz", pr, nil
......@@ -90,6 +90,10 @@ func (c *ArtifactsUploaderCommand) createAndUpload() (bool, error) {
if err != nil {
return false, err
}
if stream == nil {
logrus.Errorln("No files to upload")
return false, nil
}
defer stream.Close()
// Create the archive
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment