From bf5d1b7f4df4db79f0b7daa09e1365ef5dba92f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Samin?= Date: Mon, 21 Mar 2022 11:57:01 +0100 Subject: [PATCH] fix(api): raise error if git.branch and git.tag are set (#6104) --- engine/api/workflow/process_node.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/api/workflow/process_node.go b/engine/api/workflow/process_node.go index 678e10697e..7eca0811aa 100644 --- a/engine/api/workflow/process_node.go +++ b/engine/api/workflow/process_node.go @@ -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)))