-
Notifications
You must be signed in to change notification settings - Fork 288
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
[check] Allow triggering with tag updates #223
Conversation
This seems to overlap with #225 which was submitted later but seems a bit more thorough. Do you mind if we just focus our efforts on that PR? Thanks for submitting though! |
After verification it would have been easier to continue on this one. The only 2 things missing are the unit test and the line git with sed. But it's your call ;) My suggestion have been added on #225 |
@talset Thanks for your help on the other PR! Now that I look at it these two have different end goals so that would explain the difference in testing. Didn't mean to imply theirs was particularly better or anything. 🙂 But at least we can get the other one in first to reduce merge conflicts. |
$tag_filter is a variable not a directory. The check should be -n not -d.
Current git resource is only watch tags name but not tags update. So pipelines aren't triggered when the tag is updated and the resource with `error: pathspec 'DEV' did not match any file(s) known to git.` To solve it I suggest to not use only ref but ref and commit when tag_filter is used. This commit allow to store the tag name and commit id associeted to tag as "version" of the resource. With thos way we are able to re-trigger the pipeline when a the tags is updated.
Add --force option on git tag in order to be able to update existing tag. It help to test the filter_tags code by validating a changes on the tag commit.
When no branch are specified it clone master. We dont need to get all branches, so we can use --single-branch as previously even if no branch are specified.
--list is only required once
Thanks @vito, I rebased my commit and keep the only missing part to add commit and ref when we are using tags. Let me know if something need to be changed. |
@@ -34,7 +34,7 @@ configure_git_global "${git_config_payload}" | |||
destination=$TMPDIR/git-resource-repo-cache | |||
|
|||
tagflag="" | |||
if [ -d $tag_filter ]; then |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I need this improvement for my workflow too. My understanding is that the change introduced with #225 is sufficient but it still make sense to wait for this one for additional functionality (commit and ref). Correct? Is there anything stopping you from merging this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assets/check
Outdated
get_commit(){ | ||
for TAG in $*; do | ||
COMMIT=$(git rev-list -n 1 $TAG) | ||
echo "{ \"ref\": \"$TAG\", \"commit\": \"$COMMIT\" }" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Suggested by vito: use jq just in case someone has funny tag names. Use lowercase variables
tagflag="--tags" | ||
fi | ||
|
||
git clone $depthflag $uri $branchflag $destination $tagflag | ||
git clone --single-branch $depthflag $uri $branchflag $destination $tagflag |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
Any chance for a new release that would include this? |
I don't know when it will be realesed on the official docker hub but If you need it temporarly you can use mine |
@michaelklishin @talset Just published 1.1, sorry for the delay! It's available on Docker Hub as |
Will this fix the original problem, #74, that any behavior having to do with tags (tag_filter) ignore branches completely? |
This PR fix only the ability to replace an existing tag but the previous PR with
do the job of ignore branches for tag_filter |
From a customer usecase, they use git tag like the docker way by updating static tag on new release:
git tag can be updating by changing the commit associeted
Current git resource is only watch tags name but not tags update. So pipelines aren't triggered when the tag is updated and if the tag if from a different branch from the specified (or master) the resource fail with
error: pathspec 'DEV' did not match any file(s) known to git.
To solve it I suggest to not use only ref but ref and commit when tag_filter is used.
This commit allow to store the tag name and commit id associeted to the tag as "version" of the resource. With thos way we are able to re-trigger the pipeline when a the tags is updated.
Here is an example or resource output with tag_filters:
resource versions can be enabled or disabled as well
Let me know if something need to be changed