pipelines-as-code icon indicating copy to clipboard operation
pipelines-as-code copied to clipboard

Enhance CEL expression to accept any branch

Open savitaashture opened this issue 1 year ago โ€ข 3 comments

This change helps PAC users to provide refs/heads/* to target_branch and source_branch

Screencast from 2024-02-16 22-24-36.webm

Signed-off-by: Savita Ashture [email protected]

Changes

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

savitaashture avatar Feb 16 '24 15:02 savitaashture

/test

savitaashture avatar Feb 19 '24 06:02 savitaashture

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.48%. Comparing base (16596b4) to head (c0f1403).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1593      +/-   ##
==========================================
+ Coverage   64.41%   64.48%   +0.07%     
==========================================
  Files         143      143              
  Lines       11091    11108      +17     
==========================================
+ Hits         7144     7163      +19     
+ Misses       3421     3420       -1     
+ Partials      526      525       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 19 '24 06:02 codecov[bot]

/test

savitaashture avatar Feb 26 '24 06:02 savitaashture

/test

savitaashture avatar May 06 '24 06:05 savitaashture

/test linters

savitaashture avatar May 06 '24 07:05 savitaashture

@savitaashture i am not confident the way we are doing is the right way, if we start trying to figure out what the CEL expressions (which is a turing complete language) the user mean with substrings and pattern match it will become a problem with way we don't know (the CEL spec is quite versatile)...

we need an alternative way to address the issue properly, something like allowing annotations target AND cel expression in the future, so the user can communicate that intent properly.

happy to discuss this later on in our weekly meeting.......

chmouel avatar May 06 '24 07:05 chmouel

@savitaashture i am not confident the way we are doing is the right way, if we start trying to figure out what the CEL expressions (which is a turing complete language) the user mean with substrings and pattern match it will become a problem with way we don't know (the CEL spec is quite versatile)...

we need an alternative way to address the issue properly, something like allowing annotations target AND cel expression in the future, so the user can communicate that intent properly.

happy to discuss this later on in our weekly meeting.......

Yes Lets discuss this in pac call even i m not quite happy because we have lot of cases and scenarios user can provide using cel

savitaashture avatar May 06 '24 08:05 savitaashture

Discussion points from PAC call:

  • Lets keep the existing CEL functionality as it is
    • Lets not add branch matching support for globe pattern as CEL is a language and handling all those globe pattern will lead to complexity
  • Introduce pipelinesascode.tekton.dev/on-source-branch annotation to handle source branch match from annotation
  • No globe pattern for branch supported from CEL expressions lets add a documentation for the same

Closing this PR and opening new one with on-source-branch annotation

savitaashture avatar May 06 '24 12:05 savitaashture