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

Suggestion: Allow git sparse checkout / checkout specific directory

Open wyattjsmith1 opened this issue 5 years ago • 2 comments

As I have everything in a monorepo, it would be great if we could checkout specific directories as resources.

Consider a case with a monorepo with 2 services and a ci directory for task configurations:

/
|- ci
|- service-a
|- service-b

I only want to run tests on a specific service if the files within that service change, so I'd use two separate resources (named service-a/b) with the paths param set to their respective directories:

- type: git
  name: service-a
  source:
    uri: "https://my-repo"
    paths:
    - service-a/**
- {service b definition here}
- type: git
  name: ci
  source:
    uri: "https://my-repo"
    paths:
    - ci/**

I'd have two jobs, one for each service, and each job would start with a get: service-a/b and a get: ci:

- name: build-service-a
  plan:
  - get: service-a
    trigger: true
  - get: ci
  - task: build
    file: ci/ci/task.yaml

This is great, but it doesn't actually clone service-x and ci into the task working directory, it clones the entire repository. In the case above, the task directory would contain two instances of the monorepo, just named differently. There is no technical issue with this, but it is annoying and confusing to have to prepend /ci/ci when specifying my task.

I believe allowing a git resource to clone a sub-directory of the repository would solve this issue easily.

wyattjsmith1 avatar Jul 29 '19 00:07 wyattjsmith1

Bump. @wyattjsmith1 Did you ever get an response on this?

stwomack avatar Jan 05 '21 19:01 stwomack

Nope! I don't use concourse anymore, but I still think this would be a nice feature.

wyattjsmith1 avatar Jan 05 '21 19:01 wyattjsmith1