concourse / git-resource

tracks commits in a branch of a Git repository
Apache License 2.0
192 stars 288 forks source link

Cannot fetch/checkout specific version with no branch #415

Open gsaslis opened 1 year ago

gsaslis commented 1 year ago

Describe the bug

Reproduction steps

  1. Start up concourse (7.9.1)
  2. Define pipeline
---
resources:
- icon: git
  name: repo
  source:
    uri: "https://radicle.yorgos.net.gr/z4QJ2XjzjTioTfuWkR2J2rJjeL9dg.git"
  type: git

jobs:
- name: configure-pipeline
  plan:
  - get: "repo"
    params:
      fetch: ["48bb15c1ed6f085c0ee0b3f813a991cedd195f2b", "4c4a3907f9e13018f7899b4ae98d92782fa5ab44"]
    version:
      ref: 4c4a3907f9e13018f7899b4ae98d92782fa5ab44

  - file: "repo/.concourse/config.yaml"
    set_pipeline: self
    vars:
      patch_head: 4c4a3907f9e13018f7899b4ae98d92782fa5ab44
  1. Create and trigger pipeline in concourse
fly -t tutorial set-pipeline -p repo-configure -c pipeline.yaml
fly -t tutorial unpause-pipeline -p config
fly -t tutorial trigger-job --job config/configure-pipeline --watch
  1. Job gets stuck on:
preparing build
checking pipeline is not paused
checking job is not paused
discovering any new versions of repo
waiting for a suitable set of input versions
repo - pinned version ref:4c4a3907f9e13018f7899b4ae98d92782fa5ab44 not found
checking max-in-flight is not reached

Expected behavior

I should be able to fetch/checkout specific commits, even when they are not on a branch.

Here is the commit https://app.radicle.xyz/nodes/radicle.yorgos.net.gr/rad:z4QJ2XjzjTioTfuWkR2J2rJjeL9dg/commits/4c4a3907f9e13018f7899b4ae98d92782fa5ab44

Here is how I can clone the repo and checkout the specific commit with git tooling:

git clone https://radicle.yorgos.net.gr/z4QJ2XjzjTioTfuWkR2J2rJjeL9dg.git test-my-ci
cd test-my-ci
git fetch origin 48bb15c1ed6f085c0ee0b3f813a991cedd195f2b
git fetch origin 4c4a3907f9e13018f7899b4ae98d92782fa5ab44
git checkout FETCH_HEAD

Additional context

I tried various permutations of this:

... with no luck.

If it sounds like this scenario should be supported and that there should be some combination that supports this, I would really appreciate some pointers!

Thanks in advance!!

Relevant references I found:

qzk commented 1 year ago

this is a hack, but try to change uri: "https://..." into: uri: "--no-single-branch https://..."

does that go through for you?