git-tags-resource #
A Concourse resource type to interact with git tags, regardless of provider.
It uses pure git operations instead of interacting with various providers'
APIs.
Usage #
Example #
resource_types:
- name: git-tags
type: registry-image
source:
repository: atcr.io/joshghiloni.me/git-tags-resource
tag: stable
resources:
- name: git-tags-resource-trigger
type: git-tags
source:
uri: git@tangled.org:joshghiloni.me/git-tags-resource
private_key: ((git_private_key))
pattern: "*.*.*"
- name: git-tags-resource-trigger
type: git
source:
uri: git@tangled.org:joshghiloni.me/git-tags-resource
private_key: ((git_private_key))
jobs:
- name: new-tag
plan:
- get: git-tags-resource
trigger: true
params:
clone: true
- task: do-something
...
- put: git-tags-resource
params:
tag: task-output/new-tag
ref: task-output/.git/short_ref
message: "some message"
Source #
This resources uses a subset of the parameters available to the git resource.
Specifically, the following parameters are respected:
uri(Required)private_keyprivate_key_userprivate_key_passphraseforward_agentusernamepasswordskip_ssl_verificationgit_configsubmodule_credentialsgit_crypt_keyhttps_tunneldebug
All others may be passed but are ignored. In addition it has one additional parameter:
pattern(optional, string): A glob-style pattern used for matching against tags. Must be compatible withgit ls-remote. Defaults to*.*.*.
Behavior #
check: Check for new tags #
The repository is checked for new commits without cloning and any new tags are returned.
Tags are always sorted by their associated commits, regardless of if they match semantic
versioning or not, so if v2.0.0 is associated with commit 0000001 and v1.1.1 is
associated with 0000002, and 0000002 is a child of 0000001, then v1.1.1 will be
considered newer.
in: Get new tags #
Gets the tag information about the repository. If the clone parameter listed below is set
to true, it will clone the repository using the mechanics of the git resource's in
script. In addition, the following files will be created:
.git/tag-name: The name of the tag fetched..git/commit: The full commit SHA associated with the tag. Ifcloneis true, it will come from thegitresource's code..git/ref: The full ref name associated with the tag. Ifcloneistrue, it will come from thegitresource's code.
out: Not implemented #
The git-tags resource does not push new tags -- The git resource already has all the
capabilities necessary to do this.