func (c *ArtifactsDownloaderCommand) Execute(context *cli.Context) { formatter.SetRunnerFormatter() if len(c.URL) == 0 || len(c.Token) == 0 { logrus.Fatalln("Missing runner credentials") } if c.ID <= 0 { logrus.Fatalln("Missing build ID") } // Create temporary file file, err := ioutil.TempFile("", "artifacts") if err != nil { logrus.Fatalln(err) } file.Close() defer os.Remove(file.Name()) // Download artifacts file err = c.doRetry(func() (bool, error) { return c.download(file.Name()) }) if err != nil { logrus.Fatalln(err) } // Extract artifacts file err = archives.ExtractZipFile(file.Name()) if err != nil { logrus.Fatalln(err) } }
func (c *CacheExtractorCommand) Execute(context *cli.Context) { formatter.SetRunnerFormatter() if len(c.File) == 0 { logrus.Fatalln("Missing cache file") } if c.URL != "" { err := c.doRetry(c.download) if err != nil && !os.IsNotExist(err) { logrus.Warningln(err) } } err := archives.ExtractZipFile(c.File) if err != nil && !os.IsNotExist(err) { logrus.Fatalln(err) } }