Fix tags filtering resulting in paths filter being ignored #437
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #292 - currently if a tag filter is specified then any other filters, such as the path filter are ignored. The version_depth parameter is also incorrectly ignored.
We have added a
tag_behaviour
option, with a default value ofmatch_tagged
.match_tagged
implements the previous expected behaviour of the tag filter options operating in an AND manner with the other specified filters.The
match_tag_ancestors
value implements new functionality which will be useful for those using a tag filter. This will output commits which match the other specified filters, and are ancestors of a commit matching one of the tag filters. For example, if you filter for the2.0.0
tag, but the commit tagged with2.0.0
did not change one of the specified paths, the git resource will return a commit that is an ancestor of the2.0.0
commit which did change one of the paths. This is useful when operating with semver versions to find a commit within a version that modifies a tag.We also updated the version of Ubuntu used as the resource base image due to the previous version including a version of jq which incorrectly treated an empty input as valid JSON. This could result in tests incorrectly passing, when an empty output from the resource type should result in failure.
Note that while making these changes we discovered that the tests
it_skips_all_non_included_commits
andit_returns_list_of_all_tags_in_metadata
are non deterministic and can occasionally incorrectly fail.