Skip to content
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

fix: Revert GitOps event_type to pull_request #1729

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Jul 1, 2024

Reverted the following event types to 'pull_request':

  • NoOpsCommentEventType
  • TestAllCommentEventType
  • TestSingleCommentEventType
  • RetestSingleCommentEventType
  • RetestAllCommentEventType
  • OnCommentEventType
  • CancelCommentSingleEventType
  • CancelCommentAllEventType
  • OkToTestCommentEventType
  • This change restores compatibility for users relying on
    'pull_request' event type for filtering GitOps comments.

  • Added deprecation notice in documentation for future changes to event types.

  • Added deprecation notice in the events stream when deprecated events
    comment is used.

  • Planned deprecation period to be determined and communicated in future
    updates.

Breaking Changes:

  • None. This change restores previous behavior.

Deprecated:

  • Specific event types for GitOps comments (to be deprecated in future release).

TODO:

  • Plan and communicate deprecation timeline for specific GitOps comment
    event types.
  • Update documentation with clear migration path for future changes.

Fixes https://issues.redhat.com/browse/SRVKP-5775

Signed-off-by: Chmouel Boudjnah [email protected]

Submitter Checklist

  • πŸ“ Please ensure your commit message is clear and informative. For guidance on crafting effective commit messages, refer to the How to write a git commit message guide. We prefer the commit message to be included in the PR body itself rather than a link to an external website (ie: Jira ticket).

  • β™½ Before submitting a PR, run make test lint to avoid unnecessary CI processing. For an even more efficient workflow, consider installing pre-commit and running pre-commit install in the root of this repository.

  • ✨ We use linters to maintain clean and consistent code. Please ensure you've run make lint before submitting a PR. Some linters offer a --fix mode, which can be executed with the command make fix-linters (ensure markdownlint and golangci-lint tools are installed first).

  • πŸ“– If you're introducing a user-facing feature or changing existing behavior, please ensure it's properly documented.

  • πŸ§ͺ While 100% coverage isn't a requirement, we encourage unit tests for any code changes where possible.

  • 🎁 If feasible, please check if an end-to-end test can be added. See README for more details.

  • πŸ”Ž If there's any flakiness in the CI tests, don't necessarily ignore it. It's better to address the issue before merging, or provide a valid reason to bypass it if fixing isn't possible (e.g., token rate limitations).

@chmouel
Copy link
Member Author

chmouel commented Jul 2, 2024

/retest

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 64.64%. Comparing base (b466ac7) to head (4484a57).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1729      +/-   ##
==========================================
- Coverage   64.65%   64.64%   -0.02%     
==========================================
  Files         145      146       +1     
  Lines       11195    11265      +70     
==========================================
+ Hits         7238     7282      +44     
- Misses       3428     3452      +24     
- Partials      529      531       +2     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

Copy link
Contributor

@enarha enarha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the documentation bit, the rest is lgtm.


## Event Type Annotation and dynamic variables

The `pipeline.tekton.dev/event-type` annotation on labels indicates the type of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "annotation on labels"?

"...GitOps command which triggered the pipelinerun" sounds simpler to me.

Copy link
Member

@savitaashture savitaashture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chmouel verified below scenarios

  • For all the /test, /retest, /test and/retest ` i see event_type as pull_request
  • For on-comment annotations event_type is no-ops-comment
  • For invalid gitops comments also event_type is no-ops-comment
  • I also see deprecation notice in the controller log as well as in the events
<unknown>   Warning   DeprecatedOpsComment      repository/savitaashture-test-pac             the test-all-comment event type is deprecated, this will be changed to pull_request in the future
<unknown>   Warning   DeprecatedOpsComment      repository/savitaashture-test-pac             the retest-comment event type is deprecated, this will be changed to pull_request in the future

docs/content/docs/guide/gitops_commands.md Outdated Show resolved Hide resolved
docs/content/docs/guide/gitops_commands.md Outdated Show resolved Hide resolved
pkg/opscomments/comments.go Show resolved Hide resolved
// we keep on-comment to the "on-comment" type
func EventTypeBackwardCompat(eventEmitter *events.EventEmitter, repo *v1alpha1.Repository, label string) string {
if label == OnCommentEventType.String() {
return label
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we consider on-comment also as no-ops-comment ???

Asking because when i specify pipelinesascode.tekton.dev/on-comment: "^/hello-world" in PipelineRun yaml and print {{ event_type }} i get no-ops-comment and even for non on-comment gitops comments like /savita i get {{ event_type }} as no-ops-comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chmouel how about this ???

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah weird ! does that happen before this pr as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah actually i did not check that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and can reproduce on the main branch too and created a jira issue for it... will try to do it asap but we can still merge this PR since on-comments is TP

jira: https://issues.redhat.com/browse/SRVKP-5779

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes πŸ‘

- Reverted the following event types to 'pull_request':
  * NoOpsCommentEventType
  * TestAllCommentEventType
  * TestSingleCommentEventType
  * RetestSingleCommentEventType
  * RetestAllCommentEventType
  * OnCommentEventType
  * CancelCommentSingleEventType
  * CancelCommentAllEventType
  * OkToTestCommentEventType

- This change restores compatibility for users relying on
  'pull_request' event type for filtering GitOps comments.

- Added deprecation notice in documentation for future changes to event types.

- Added deprecation notice in the events stream when deprecated events
  comment is used.

- Planned deprecation period to be determined and communicated in future
  updates.

Breaking Changes:
- None. This change restores previous behavior.

Deprecated:
- Specific event types for GitOps comments (to be deprecated in future release).

TODO:
- Plan and communicate deprecation timeline for specific GitOps comment
  event types.
- Update documentation with clear migration path for future changes.

Fixes https://issues.redhat.com/browse/SRVKP-5775

Signed-off-by: Chmouel Boudjnah <[email protected]>
@chmouel chmouel force-pushed the SRVKP-5775-backward-compat-gitops-comments-event-type branch from 58dc16a to 4484a57 Compare July 3, 2024 12:51
@savitaashture
Copy link
Member

@chmouel can we add e2e test to verify event_type

@savitaashture
Copy link
Member

@savitaashture it's already there? https://github.com/openshift-pipelines/pipelines-as-code/pull/1729/files#diff-f856a475e31a6ac95f3ceaafdd87afd5dc57cde21dcc66f148663ebfc1be5be1R210

Okok sorry missed that

@savitaashture
Copy link
Member

Thank you

/lgtm

@savitaashture savitaashture merged commit be424e4 into openshift-pipelines:main Jul 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants