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

After pushing a tag, the tag disappears on rebuilds

Open ari-becker opened this issue 6 years ago • 2 comments

Example pipeline:

resources:
- name: repository
  type: git
  source:
    uri: [email protected]:foo/bar.git
    private_key: ((ssh-private-key))
  check_every: 24h
  webhook_token: ((webhook-token))
jobs:
- name: idempotent
  plan:
  - get: repository
    trigger: true
  - task: show-tags
    config:
      platform: linux
      image_resource:
        type: registry-image
        source: { repository: alpine }
      inputs:
      - name: repository
      run:
        path: /bin/sh
        args:
        - -c
        - ls repository/.git/refs/tags
  - put: repository
    inputs: [ repository ]
    params:
      repository: repository
      tag: repository/version
      only_tag: true

for a repository foo/bar containing a file version that may be updated, say, from 1.0.0 to 1.1.0.

The first time this job is built, no tags exist yet, so show-tags shows nothing. At the end of the first build, the tag in the version file is pushed to the repository. When the build is re-run, the commit ref hash of HEAD has not changed, so Concourse uses the cached version of the resource instead of fetching / pulling the list of tags from remote. As a result, on a second build, ls repository/.git/refs/tags shows nothing - even though it should show a file whose name is the contents of the version file, corresponding with the put step in the first build. The tag has, in effect, disappeared from the CI environment.

I'm not sure what the solution is (a separate resource for a repository's tags? the git resource having a more nuanced notion of version than just the commit ref hash?) but this behavior surprised me and I consider it to be a bug.

ari-becker avatar Jan 15 '20 14:01 ari-becker

Seeing the same behaviour, which was initially head scratching. Agreed, would also consider this a bug.

StuWill avatar Nov 10 '22 16:11 StuWill

I am having the same problem

anielsen avatar Jan 26 '23 09:01 anielsen