Commit 2921ba45 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

- Use artifact-format,artifact-type names for indicating gitlab-rails...

- Use artifact-format,artifact-type names for indicating gitlab-rails JobArtifacts.file_format and JobArtifacts.file_type.
- Pass format and type in the abstract class.
- Specify filename if it's raw-single artifact, rather than naming it as artifact.
parent af12311e
......@@ -25,8 +25,8 @@ type ArtifactsUploaderCommand struct {
Name string `long:"name" description:"The name of the archive"`
ExpireIn string `long:"expire-in" description:"When to expire artifacts"`
Format common.ArtifactFormat `long:"format" description:"Format of generated artifacts"`
Type string `long:"type" description:"Type of generated artifacts"`
Format common.ArtifactFormat `long:"artifact-format" description:"Format of generated artifacts"`
Type string `long:"artifact-type" description:"Type of generated artifacts"`
}
func (c *ArtifactsUploaderCommand) generateZipArchive(w *io.PipeWriter) {
......@@ -51,6 +51,11 @@ func (c *ArtifactsUploaderCommand) createReadStream() (string, io.ReadCloser, er
return "", nil, errors.New("raw format accepts only single file to upload")
}
for k := range c.files {
artifactsName = k
break
}
file, err := os.Open(c.sortedFiles()[0])
return artifactsName, file, err
......
......@@ -203,8 +203,8 @@ type Artifact struct {
Untracked bool `json:"untracked"`
Paths ArtifactPaths `json:"paths"`
When ArtifactWhen `json:"when"`
Type string `json:"type"`
Format ArtifactFormat `json:"format"`
Type string `json:"artifact_type"`
Format ArtifactFormat `json:"artifact_format"`
ExpireIn string `json:"expire_in"`
}
......
......@@ -414,10 +414,10 @@ func (n *GitLabClient) UploadRawArtifacts(config common.JobCredentials, reader i
query.Set("expire_in", options.ExpireIn)
}
if options.Format != "" {
query.Set("format", string(options.Format))
query.Set("artifact_format", string(options.Format))
}
if options.Type != "" {
query.Set("type", options.Type)
query.Set("artifact_type", options.Type)
}
headers := make(http.Header)
......
......@@ -500,9 +500,9 @@ func (b *AbstractShell) uploadArtifacts(w ShellWriter, info common.ShellScriptIn
info.Build.Token,
"--id",
strconv.Itoa(info.Build.ID),
"--format",
"--artifact-format",
string(artifacts.Format),
"--type",
"--artifact-type",
artifacts.Type,
}
......@@ -530,6 +530,14 @@ func (b *AbstractShell) uploadArtifacts(w ShellWriter, info common.ShellScriptIn
args = append(args, "--expire-in", artifacts.ExpireIn)
}
if artifacts.Format != "" {
args = append(args, "--artifact-format", string(artifacts.Format))
}
if artifacts.Type != "" {
args = append(args, "--artifact-type", artifacts.Type)
}
b.guardRunnerCommand(w, info.RunnerCommand, "Uploading artifacts", func() {
w.Notice("Uploading artifacts...")
w.Command(info.RunnerCommand, args...)
......
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