Skip to content

Clarification About GitOps Command Execution on Pushed Commits #1911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading