Skip to content

Commit

Permalink
Clearification about GitOps command execution on pushed commits
Browse files Browse the repository at this point in the history
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 <zashaikh@redhat.com>
  • Loading branch information
zakisk committed Feb 12, 2025
1 parent c1ef894 commit 2ea71bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/content/docs/guide/gitops_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ For restarting all pipeline runs:
For restarting a specific pipeline run:
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.

The GitOps command triggers a PipelineRun only on the latest commit (HEAD) of the branch and does not work on older commits.

**Note:**

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.

This means:

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.
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.

Examples:
1. `/retest`
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,5 +600,5 @@ func (v *Provider) isBranchContainsCommit(ctx context.Context, runevent *info.Ev
if branchInfo.Commit.GetSHA() == runevent.SHA {
return nil
}
return fmt.Errorf("provided branch %s does not contains sha %s", branchName, runevent.SHA)
return fmt.Errorf("provided SHA %s is not the HEAD commit of the branch %s", runevent.SHA, branchName)
}
2 changes: 1 addition & 1 deletion pkg/provider/github/parse_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func TestParsePayLoad(t *testing.T) {
shaRet: "samplePRshanew",
targetPipelinerun: "dummy",
wantedBranchName: "main",
wantErrString: "provided branch main does not contains sha samplePRshanew",
wantErrString: "provided SHA samplePRshanew is not the HEAD commit of the branch main",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 2ea71bd

Please sign in to comment.