in shells/abstract.go [1270:1329]
func (b *AbstractShell) writeUploadArtifact(w ShellWriter, info common.ShellScriptInfo, artifact common.Artifact) bool {
args := []string{
"artifacts-uploader",
"--url",
info.Build.Runner.URL,
"--token",
info.Build.Token,
"--id",
strconv.FormatInt(info.Build.ID, 10),
}
if b.shouldGenerateArtifactsMetadata(info, artifact) {
args = append(args, b.generateArtifactsMetadataArgs(info)...)
}
// Create list of files to archive
var archiverArgs []string
for _, path := range artifact.Paths {
archiverArgs = append(archiverArgs, "--path", path)
}
// Create list of paths to be excluded from the archive
for _, path := range artifact.Exclude {
archiverArgs = append(archiverArgs, "--exclude", path)
}
if artifact.Untracked {
archiverArgs = append(archiverArgs, "--untracked")
}
if len(archiverArgs) < 1 {
// Skip creating archive
return false
}
args = append(args, archiverArgs...)
if artifact.Name != "" {
args = append(args, "--name", artifact.Name)
}
if artifact.ExpireIn != "" {
args = append(args, "--expire-in", artifact.ExpireIn)
}
if artifact.Format != "" {
args = append(args, "--artifact-format", string(artifact.Format))
}
if artifact.Type != "" {
args = append(args, "--artifact-type", artifact.Type)
}
b.guardRunnerCommand(w, info.RunnerCommand, "Uploading artifacts", func() {
w.Noticef("Uploading artifacts...")
w.Command(info.RunnerCommand, args...)
})
return true
}