Skip to content

trigger: expose triggering comment ID and URL in JOB_SPEC#770

Open
tiborv wants to merge 1 commit into
kubernetes-sigs:mainfrom
tiborv:trigger-comment-in-job-spec
Open

trigger: expose triggering comment ID and URL in JOB_SPEC#770
tiborv wants to merge 1 commit into
kubernetes-sigs:mainfrom
tiborv:trigger-comment-in-job-spec

Conversation

@tiborv

@tiborv tiborv commented Jun 24, 2026

Copy link
Copy Markdown

Parsing arguments out of a command (e.g. /test <args>) is currently unreliable for jobs: a job only receives the PR refs, not the comment that triggered it. Reconstructing the comment from the PR number alone is racy — concurrent or edited /test comments resolve to the wrong body, and UI reruns have no comment at all.

This captures the triggering comment in ProwJobSpec via a new optional trigger_comment object and surfaces it to comment-triggered presubmits as two env vars:

  • TRIGGER_COMMENT_ID — numeric GitHub comment ID
  • TRIGGER_COMMENT_URL — full HTML URL to the comment

Both are also available in the JSON-encoded JOB_SPEC under trigger_comment.id / trigger_comment.html_url. The comment ID is a stable, unique reference to the exact comment that triggered the run, so a job can fetch its body via the GitHub API directly. The URL also enables a clickable link in reports or distinguishing a manual rerun from an automatic one.

Parsing arguments out of a command (e.g. "/test <args>") is currently
unreliable for jobs: a job only receives the PR refs, not the comment
that triggered it. Reconstructing the comment from the PR number alone
is racy - concurrent or edited /test comments resolve to the wrong
body, and UI reruns have no comment at all.

This captures the triggering comment in ProwJobSpec via a new optional
trigger_comment object and surfaces it to comment-triggered presubmits
as two env vars:

  TRIGGER_COMMENT_ID  - numeric GitHub comment ID
  TRIGGER_COMMENT_URL - full HTML URL to the comment

Both are also available in the JSON-encoded JOB_SPEC under
trigger_comment.id / trigger_comment.html_url. The comment ID is a
stable, unique reference to the exact comment that triggered the run,
so a job can fetch its body via the GitHub API directly. The URL also
enables a clickable link in reports or distinguishing a manual rerun
from an automatic one.

The field uses omitempty and is nil for jobs triggered automatically
(PR open/update, Tide, periodics), so this is fully backward
compatible.
@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 043dffc
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/6a3b9074b0724c000732e853
😎 Deploy Preview https://deploy-preview-770--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 24, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: tiborv / name: Tibor Vukovic (043dffc)

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @tiborv!

It looks like this is your first PR to kubernetes-sigs/prow 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/prow has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @tiborv. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tiborv
Once this PR has been reviewed and has the lgtm label, please assign petr-muller for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot requested a review from cjwagner June 24, 2026 08:08
@kubernetes-prow kubernetes-prow Bot added the area/documentation Issues or PRs related to documentation label Jun 24, 2026
@kubernetes-prow kubernetes-prow Bot added area/plugins Issues or PRs related to prow's plugins for the hook component area/pod-utilities Issues or PRs related to prow's pod-utilities component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 24, 2026
@petr-muller

petr-muller commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Parsing arguments out of a command (e.g. /test ) is currently unreliable for jobs

It's not unreliable, it's a hack at best. We actively did not want presubmits with manually supplied arguments to exist in Prow, so I'm not too keen about enabling it through coupling job workloads with trigger comments.

@tiborv

tiborv commented Jun 24, 2026

Copy link
Copy Markdown
Author

Parsing arguments out of a command (e.g. /test ) is currently unreliable for jobs

It's not unreliable, it's a hack at best. We actively did not want presubmits with manually supplied arguments to exist in Prow, so I'm not too keen about enabling it through coupling job workloads with trigger comments.

If the concern is primarily about the indeterminism of job triggers if args are parsed dynamically, can I instead just try to surface more metadata about the trigger event in general? E.g. TRIGGER_EVENT_TYPE=IssueCommentEvent, TRIGGER_EVENT_ID, TRIGGER_EVENT_URL etc.

Or is the goal to actively discourage a job from 'knowing' its specific triggering event entirely?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Issues or PRs related to documentation area/plugins Issues or PRs related to prow's plugins for the hook component area/pod-utilities Issues or PRs related to prow's pod-utilities component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants