Skip to content

Commit

Permalink
fix(api): raise error if git.branch and git.tag are set (#6104)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored Mar 21, 2022
1 parent fce41f8 commit bf5d1b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions engine/api/workflow/process_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ func processNode(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store cac
return nil, false, sdk.WrapError(sdk.ErrNoReposManagerClientAuth, "cannot get client %s %s got: %v", proj.Key, app.VCSServer, err)
}

// We can't have both git.branch and git.tag values
if currentJobGitValues["git.branch"] != "" && currentJobGitValues["git.tag"] != "" {
return nil, false, sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("invalid git variables"))
}

vcsInf, errVcs = getVCSInfos(ctx, db, store, proj.Key, vcsServer, currentJobGitValues, app.Name, app.VCSServer, app.RepositoryFullname)
if errVcs != nil {
AddWorkflowRunInfo(wr, sdk.SpawnMsgNew(*sdk.MsgWorkflowError, sdk.ExtractHTTPError(errVcs)))
Expand Down

0 comments on commit bf5d1b7

Please sign in to comment.