Skip to content

Commit 5c72931

Browse files
committed
Clearification about GitOps command execution on pushed commits
in docs it was not specified that GitOps command on pushed commit only works on latest HEAD commit and does not trigger PipelineRun if sent on older commits. Signed-off-by: Zaki Shaikh <[email protected]>
1 parent 964f82b commit 5c72931

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

docs/content/docs/guide/gitops_commands.md

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ For restarting all pipeline runs:
4646
For restarting a specific pipeline run:
4747
2. Use `/retest <pipelinerun-name>` or `/test <pipelinerun-name>` within your commit message. Replace `<pipelinerun-name>` with the specific name of the pipeline run you want to restart.
4848

49+
The GitOps command triggers a PipelineRun only on the latest commit (HEAD) of the branch and does not work on older commits.
50+
4951
**Note:**
5052

5153
When executing `GitOps` commands on a commit that exists in multiple branches within a push request, the branch with the latest commit will be used.

pkg/provider/github/github.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -600,5 +600,5 @@ func (v *Provider) isBranchContainsCommit(ctx context.Context, runevent *info.Ev
600600
if branchInfo.Commit.GetSHA() == runevent.SHA {
601601
return nil
602602
}
603-
return fmt.Errorf("provided branch %s does not contains sha %s", branchName, runevent.SHA)
603+
return fmt.Errorf("provided SHA %s is not the HEAD commit of the branch %s", runevent.SHA, branchName)
604604
}

pkg/provider/github/parse_payload_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ func TestParsePayLoad(t *testing.T) {
539539
shaRet: "samplePRshanew",
540540
targetPipelinerun: "dummy",
541541
wantedBranchName: "main",
542-
wantErrString: "provided branch main does not contains sha samplePRshanew",
542+
wantErrString: "provided SHA samplePRshanew is not the HEAD commit of the branch main",
543543
},
544544
}
545545
for _, tt := range tests {

0 commit comments

Comments
 (0)