Cannot see all git tags for github repo java-buildpack when cloning by Concourse git-resource
search cancel

Cannot see all git tags for github repo java-buildpack when cloning by Concourse git-resource

book

Article ID: 297251

calendar_today

Updated On:

Products

Concourse for VMware Tanzu

Issue/Introduction

Pre-checks

  • Performing a get java-buildpack using Concourse git-resource
  • Performing a git checkout <tag-version-java-buildpack> in your Concourse task.  

Error Message

An error is reported in the failed pipeline build:
error: pathspec 'v4.21' did not match any file(s) known to git

Below is an example pipeline.yml.
resources:
- name: jbp
  type: git
  source:
    uri: https://github.com/cloudfoundry/java-buildpack.git
    branch: master
 
jobs:
- name: jTest
  plan:
  - get: jbp
  - task: taTest
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: alpine/git
          tag: latest
      inputs:
        - name: jbp
      run:
        path: sh
        args:
        - -exc
        - |
          export TERM=xterm
          cd jbp
          git tag
          git tag | wc -l
          git checkout v4.21

 

Below is the real outcome of when you run a build of the pipeline above:

7413.png

Expected Outcome

  • Total number of tags reported (as of this date): 78
  • git checkout v4.21 to succeed

Reason

If the tag_filter property is not specified when using concourse git-resource, the only candidates that are considered are the ones that are reachable from the specified branch. This is the case even when they are detached HEADs or present in other branches.

Environment

Product Version: 4.2
OS: Linux

Resolution

Specify the tag_filter property in resources section of your pipeline.yml file to be able to see the version and git checkout that is required.

Below is an example pipeline.yml.
resources:
- name: jbp
  type: git
  source:
    uri: https://github.com/cloudfoundry/java-buildpack.git
    icon: github-circle
    tag_filter: v*
 
jobs:
- name: jTest
  plan:
  - get: jbp
  - task: taTest
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: alpine/git
          tag: latest
      inputs:
        - name: jbp
      run:
        path: sh
        args:
        - -exc
        - |
          export TERM=xterm
          cd jbp
          git tag
          git tag | wc -l
          git checkout v4.21


Below is the outcome of when you run a build of the pipeline above, the output is clipped to just show the output at the end of the build:

7413-2.png