Skip to content

Commit 2ea71bd

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 c1ef894 commit 2ea71bd

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/content/docs/guide/gitops_commands.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ 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.
5254

5355
This means:
5456

55-
1. If a user specifies commands like `/retest` or `/test` without any argument in a comment on a branch, the test will automatically be performed on the **main** branch.
57+
1. When a user comments with commands like `/retest` or `/test` on a branch without specifying a branch name, the test will automatically run on the **default branch** (e.g. main, master) of the repository.
5658

5759
Examples:
5860
1. `/retest`

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)