git-resource icon indicating copy to clipboard operation
git-resource copied to clipboard

checking specific tag based on a semver

Open zeralight opened this issue 4 years ago • 1 comments

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

zeralight avatar Oct 15 '21 06:10 zeralight

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

taylorsilva avatar Mar 12 '25 16:03 taylorsilva