Skip to content

Commit bf5d1b7

Browse files
authored
fix(api): raise error if git.branch and git.tag are set (#6104)
1 parent fce41f8 commit bf5d1b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

engine/api/workflow/process_node.go

+5
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ func processNode(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store cac
245245
return nil, false, sdk.WrapError(sdk.ErrNoReposManagerClientAuth, "cannot get client %s %s got: %v", proj.Key, app.VCSServer, err)
246246
}
247247

248+
// We can't have both git.branch and git.tag values
249+
if currentJobGitValues["git.branch"] != "" && currentJobGitValues["git.tag"] != "" {
250+
return nil, false, sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("invalid git variables"))
251+
}
252+
248253
vcsInf, errVcs = getVCSInfos(ctx, db, store, proj.Key, vcsServer, currentJobGitValues, app.Name, app.VCSServer, app.RepositoryFullname)
249254
if errVcs != nil {
250255
AddWorkflowRunInfo(wr, sdk.SpawnMsgNew(*sdk.MsgWorkflowError, sdk.ExtractHTTPError(errVcs)))

0 commit comments

Comments
 (0)