git-resource
git-resource copied to clipboard
checking specific tag based on a semver
Hello,
Is there a way to make the get step of a git resource checkout a specific tag passed in a semver resource:
resources:
- name: version
type: semver
source:
driver: git
uri: ssh://git@....
branch: master
private_key: ((private_key))
file: version
- name: git-source
type: git
source:
uri: ssh://git@...
branch: master
private_key: ((private_key))
jobs:
- name: myjob
plan:
- get: version
- get: git-source
params: { tag : version/version } # <---------------- like this
tag is not a field here, so that would be a feature to add. You can specify fetch_tags in the get step params to ensure all tags are fetched.
Imagining that tag was a valid param, I would use load_var to pass in the tag. Updating your example:
resources:
- name: version
type: semver
source:
driver: git
uri: ssh://git@....
branch: master
private_key: ((private_key))
file: version
- name: git-source
type: git
source:
uri: ssh://git@...
branch: master
private_key: ((private_key))
jobs:
- name: myjob
plan:
- get: version
- load_var: version
file: version/version
- get: git-source
params: { tag : ((.:version)) } # <---------------- like this