Triggering with Git Operations
This guide provides Git command examples for triggering PAC pipelines through Git operations.
This guide shows common Git commands used to trigger PAC pipelines through Git provider events.
PAC uses webhooks from Git providers (GitHub, GitLab, Bitbucket, etc.) to detect events:
- Webhook Configuration: When you create a Repository CR, PAC automatically configures a webhook in your Git provider
- Event Detection: When events occur (push, pull request, comments), the Git provider sends a webhook to PAC controller
- Pipeline Matching: PAC controller matches the event against annotations in your PipelineRun files
- Pipeline Execution: If a match is found, PAC creates a PipelineRun in your cluster
For more details on pipeline definitions and event annotations, see Maintain Pipeline Code.
TOC
Testing Push TriggersBasic PushPush to Specific BranchEmpty CommitTesting Merge Request TriggersCreate Merge RequestUpdate Merge RequestForce Push to Merge RequestUsing Comment CommandsTrigger via CommentCommon Comment CommandsChecking Pipeline StatusView PipelineRunsView Pipeline LogsCheck Latest PipelineRunTroubleshooting Git OperationsCheck Current BranchVerify Last CommitCheck Remote BranchView Git RemoteForce Sync with RemoteNext StepsTesting Push Triggers
Basic Push
Make a change and push to trigger pipelines:
Push to Specific Branch
Create and push to a feature branch:
Empty Commit
Trigger pipeline without code changes:
Testing Merge Request Triggers
Create Merge Request
-
Create a feature branch:
-
Create a Pull/Merge Request targeting
mainbranch via your Git provider UI
Update Merge Request
Push more commits to trigger pipeline again:
Force Push to Merge Request
Rewrite history and force push:
Note: Use --force-with-lease instead of --force to prevent overwriting others' work.
Using Comment Commands
Comment commands only work in Merge Requests (Pull Requests), not in regular commits or push events.
Trigger via Comment
-
Open your Pull/Merge Request in the Git provider UI
-
Add a comment with the command:
or
- PAC will detect the comment and trigger the corresponding pipeline
Common Comment Commands
Note: The exact commands depend on your pipeline configuration. You define commands in the on-comment annotation in your PipelineRun files.
Checking Pipeline Status
View PipelineRuns
Check if pipeline was triggered:
View Pipeline Logs
View logs of a specific PipelineRun:
Or follow logs in real-time:
Check Latest PipelineRun
Get the latest PipelineRun:
Troubleshooting Git Operations
Check Current Branch
Verify you're on the correct branch:
Verify Last Commit
Check the last commit details:
Check Remote Branch
Verify branch exists on remote:
View Git Remote
Check configured remote URL:
Force Sync with Remote
Reset local branch to match remote:
Warning: This will discard local changes.
Next Steps
- Maintain Pipeline Code - Learn how to define pipelines and configure event triggers
- Configure Repository - Repository setup guide
- Common Issues - Troubleshooting guide