Add Version types tags and branches#474
Open
taylorsilva wants to merge 24 commits into
Open
Conversation
jq is installed from package manager now and ends up on $PATH automatically Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
refactored the check script to branch based on $version_type Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
updated our old jq object building usage in common.sh to use --arg, which guarantees the json to be valid. Signed-off-by: Taylor Silva <dev@taydev.net>
tests would previously take ~38s on my machine. Now they take ~30s. Speed up is from removing a sleep that was used when creating tags to ensure each tag had a different creation time. We set GIT_COMMITTER_DATE to workaround that now, which sped up our tests. Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
Signed-off-by: Taylor Silva <dev@taydev.net>
shouldn't have made any branches, meant to only have the default branches Signed-off-by: Taylor Silva <dev@taydev.net>
used claude to review for any mistakes. These are the one's I ended up impelmenting. Signed-off-by: Taylor Silva <dev@taydev.net>
e1fd55d to
1e59ea1
Compare
Member
Author
|
I'm going to leave this open for a bit for folks to give feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a massive change to the git resource. I am expanding the scope and workflows supported by this resource to support:
This change is backwards-compatible. Existing usage of this resource is NOT effected by this change. Your pipelines do not need to change and this should not break anything for anyone.
See the updated README.md for details.
TLDR: added a
version_typekey with valuescommits,tags,branches. Default iscommitsand is existing behaviour of the resource.Why
version_typeas the key?: I wanted to avoid confusion with thetypekey that's already present in the resource.Motivation
This issue kicked me off down this rabbit hole: concourse/examples#28
There have been resource types that solve these problems already. For getting branches of a repo https://github.com/aoldershaw/git-branches-resource was a resource type made by a previous maintainer. This resource is basically a copy of this resource's auth features with some other scripts bolted on.
Pretty much any resource that does things with git would start with THIS resource's scripts and build off from there. Of course those resources would go stale and drift behind this resource.
I decided to consolidate the community's effort around getting tags and branches into this resource. I've been on teams that would have really benefited from this being built into the resource.
Getting tags and branches are both light-weight operations. With branches we use
git ls-remoteand with tags we create an empty repo and only pull downrefs/tags/*.Examples
Tracking tags:
Tracking branches:
About tags...
Technically you can already pull down tags with the current release of the resource. There's already
tag_filterandtag_regexto support filtering tags. I have personally found this feature to not work as well as I would hope.Take this resource as an example where I want to track tags published to the golang/go repo for new go releases:
First, the initial cloning takes MINUTES because the resource pulls down a bunch of info that isn't related to finding tags.

Once the repo is cloned in the check step, it doesn't find all the tags! The first check returns only one tag:
This happens because 1) large repo, too much commit history for the resource to go through, so it only finds the most recent tag. Smaller repos will return more tags, 2) because we search a single branch we might miss tags. A common practice I've seen is for projects to create the tag on a commit that exists on a non-main branch. This resource struggles to find tags like that.
Overall I've found the tagging finding experience of this resource to just suck. It's slow and inaccurate.
Now, if you set
version_type: tags, we actually do find all the tags and it's basically instant!Runs in seconds and returns all the tags:

I currently have it coded to checkout the tag in a detached HEAD state. Hopefully this is fine for others use-cases.