Skip to content

Commit

Permalink
fix: tag is no more required with CDN artifact management (#5889)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux committed Jul 27, 2021
1 parent 31932b9 commit 780acb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions engine/worker/cmd_upload.go
Expand Up @@ -23,7 +23,7 @@ var cmdUploadTag string
func cmdUpload() *cobra.Command {
c := &cobra.Command{
Use: "upload",
Short: "worker upload --tag=tagValue {{.cds.workspace}}/fileToUpload",
Short: "worker upload {{.cds.workspace}}/fileToUpload",
Long: `
Inside a job, there are two ways to upload an artifact:
Expand Down Expand Up @@ -54,10 +54,6 @@ func uploadCmd() func(cmd *cobra.Command, args []string) {
sdk.Exit("cannot parse '%s' as a port number", portS)
}

if cmdUploadTag == "" {
sdk.Exit("worker upload: invalid tag. %s\n", cmd.Short)
}

if len(args) == 0 {
sdk.Exit("Wrong usage: Example : worker upload --tag={{.cds.version}} filea fileb filec*")
}
Expand Down
6 changes: 3 additions & 3 deletions engine/worker/internal/action/builtin_artifact_upload.go
Expand Up @@ -50,9 +50,6 @@ func RunArtifactUpload(ctx context.Context, wk workerruntime.Runtime, a sdk.Acti
}

tag := sdk.ParameterFind(a.Parameters, "tag")
if tag == nil {
return res, sdk.NewError(sdk.ErrWorkerErrorCommand, fmt.Errorf("tag variable is empty. aborting"))
}

// Global all files matching filePath
filesPath, err := afero.Glob(afero.NewOsFs(), artifactPath)
Expand Down Expand Up @@ -241,6 +238,9 @@ func uploadArtifactIntoCDN(path string, ctx context.Context, wk workerruntime.Ru
}

func uploadArtifactByApiCall(path string, wk workerruntime.Runtime, ctx context.Context, projectKey string, integrationName string, jobID int64, tag *sdk.Parameter) error {
if tag == nil {
return sdk.NewError(sdk.ErrWorkerErrorCommand, fmt.Errorf("tag variable is empty. aborting"))
}
throughTempURL, duration, err := wk.Client().QueueArtifactUpload(ctx, projectKey, integrationName, jobID, tag.Value, path)
if err != nil {
return err
Expand Down

0 comments on commit 780acb6

Please sign in to comment.