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

feat: allow warehouse git subs to select commits by tag #1446

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

krancour
Copy link
Member

@krancour krancour commented Jan 31, 2024

Fixes #816

This is much smaller than it looks once you ignore codegen.

This works similarly to image selection by tag:

  • Select latest commit from a given branch (existing behavior)
  • Select lexically last tag (useful if tags contain date/time stamps)
  • Select newest tag
  • Select latest tag that looks like a semantic version -- semver constaints also supported
  • Selection can be further constrained by:
    • Regex of allowed tags
    • List of forbidden tags

Copy link

netlify bot commented Jan 31, 2024

Deploy Preview for docs-kargo-akuity-io ready!

Name Link
🔨 Latest commit e6accf4
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/65bbed316df2950008ddce76
😎 Deploy Preview https://deploy-preview-1446.kargo.akuity.io
📱 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 site configuration.

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (fc05523) 48.31% compared to head (e6accf4) 48.77%.

Files Patch % Lines
internal/controller/warehouses/git.go 91.85% 10 Missing and 1 partial ⚠️
api/v1alpha1/zz_generated.deepcopy.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1446      +/-   ##
==========================================
+ Coverage   48.31%   48.77%   +0.46%     
==========================================
  Files         131      131              
  Lines       11894    12026     +132     
==========================================
+ Hits         5746     5866     +120     
- Misses       5948     5959      +11     
- Partials      200      201       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@krancour krancour force-pushed the krancour/git-filters branch from a6887ea to 516a960 Compare February 1, 2024 17:30
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour krancour force-pushed the krancour/git-filters branch from 516a960 to d3262a6 Compare February 1, 2024 19:07
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour krancour marked this pull request as ready for review February 1, 2024 19:21
@krancour krancour requested a review from a team as a code owner February 1, 2024 19:21
@krancour krancour requested a review from jessesuen February 1, 2024 23:48
Comment on lines +106 to +113
// IgnoreTags is a list of tags that must be ignored when determining the
// newest commit of interest. No regular expressions or glob patterns are
// supported yet. The value in this field only has any effect when the
// CommitSelectionStrategy is Lexical, NewestTag, or SemVer. This field is
// optional.
//
//+kubebuilder:validation:Optional
IgnoreTags []string `json:"ignoreTags,omitempty"`
Copy link
Member

@jessesuen jessesuen Feb 2, 2024

Choose a reason for hiding this comment

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

I question the need for ignoreTags, when:

  1. allowTags is a regular expression. And exclusion would be possible with a "negative lookahead":
    https://stackoverflow.com/a/2078953
  2. The fact that ignoreTags is a list of explicit strings, whereas allowTags is a regexp, making them not symetrical. If we do decide to support ignoreTags, I would have expected that to be a regexp.

Copy link
Member

Choose a reason for hiding this comment

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

Discussed offline. Image tag selection already has this feature and so it's worthwhile to offer the same with git.

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

Great feature!

@krancour
Copy link
Member Author

krancour commented Feb 2, 2024

@jessesuen thank you so much for reviewing!

@krancour krancour added this pull request to the merge queue Feb 2, 2024
Merged via the queue into akuity:main with commit 397fc3e Feb 2, 2024
17 checks passed
@krancour krancour deleted the krancour/git-filters branch February 2, 2024 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

optionally constrain git repo subscriptions by tags
3 participants