hasura / smooth-checkout-buildkite-plugin

All the things you need during a Buildkite checkout :butter: :kite:
Apache License 2.0
14 stars 12 forks source link

Shallow Checkout with `--depth 1` not working as documented #52

Open macjustice opened 4 months ago

macjustice commented 4 months ago

When using the plugin with "clone_flags": "--depth 1", as shown in the readme, I get the following error:

Checking out repository
  | 2024-07-09 20:26:02 UTC | 0
  | 2024-07-09 20:26:02 UTC | :::: local clone location = '.'
  | 2024-07-09 20:26:02 UTC | :::: checkout ref = 'alpha'
  | 2024-07-09 20:26:02 UTC | :::: git remote url = 'redacted'
  | 2024-07-09 20:26:02 UTC | :::: ssh key path = ''
  | 2024-07-09 20:26:02 UTC | :::: clone flags = ' --depth 1 '
  | 2024-07-09 20:26:02 UTC | Cloning redacted
  | 2024-07-09 20:26:02 UTC | error: unknown option `depth 1'

This is going to look a little strange since I'm generating the pipeline definition in Python, but my plugin config looks like this:

plugins=[{
    'hasura/smooth-checkout#v4.4.1': {
        'build_checkout_path': from_branch_checkout_path,
        'repos': [{
            'config': [{
                'url': os.environ.get('BUILDKITE_REPO'),
                'ref': from_branch,
                'clone_flags': '--depth 1'
            }]
        },]

The only thing that looks off to me is the spacing around --depth 1 in the pipeline logs, but that might be a display artifact.

imperfect-fourth commented 4 months ago

thanks for raising the issue. can you try the following instead?

...
'clone_flags': ['--depth', '1']
...