Skip to content

Conversation

caseybraithwaite
Copy link
Contributor

Hi 👋 ,

Haven't raised a PR on this repository before so apologies if I've done something wrong.

This PR adds the ability to do a sparse checkout.

There was some consideration in using the existing .source.paths as the paths to checkout but, within our pipelines, we came across a scenario where we wanted to trigger on certain paths but then checkout additional paths. Hopefully this is acceptable for other people.

This should close 267.

@xtremerui
Copy link
Contributor

Signed-off-by: Casey Braithwaite <casey.braithwaite@capgemini.com>
Signed-off-by: Casey Braithwaite <casey.braithwaite@capgemini.com>
@taylorsilva taylorsilva moved this from Todo to In Progress in Pull Requests Jun 19, 2025
@taylorsilva
Copy link
Member

Thanks for adding tests @caseybraithwaite
This is in my review backlog so I'll get to it eventually.

Copy link
Member

@taylorsilva taylorsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the VERY long wait. I'm never too keen to peer into these bash scripts. This is a great feature though!

Only thing missing is documenting the new field in the README. I'll do that after merging though.

I compiled and locally tested out this resource; it works as expected!

resource_types:
  - name: git
    type: registry-image
    source:
      repository: taylorsilva/git-resource
      tag: latest

resources:
  - name: repo
    type: git
    source:
      uri: https://github.com/concourse/concourse.git
      paths:
        - atc/**
      sparse_paths:
        - atc/**
        - worker/**

jobs:
  - name: job
    plan:
      - get: repo
      - task: ls
        config:
          platform: linux
          image_resource:
            type: mock
            source:
              mirror_self: true
          inputs:
            - name: repo
          run:
            path: sh
            args:
              - -c
              - |
                ls -lh ./repo

@taylorsilva taylorsilva merged commit 7013ea1 into concourse:master Jul 9, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pull Requests Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Suggestion: Allow git sparse checkout / checkout specific directory
3 participants