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

support cloning multiple git repositories #17

Closed scriptnull closed 2 years ago

scriptnull commented 2 years ago

We should probably allow something like having two smooth-checkout section or perhaps somehow give the config in a single plugin call to provide multiple repositories for cloning (note: in case of the second case we will need to think about mirrors implementation we already have and not break it)

steps:
  - command: echo "Checks out multiple repositories"
    plugins:
      - hasura/smooth-checkout#v2.0.0:
          config:
            - url: git@github.com:<username>/<reponame1>.git
      - hasura/smooth-checkout#v2.0.0:
          config:
            - url: git@github.com:<username>/<reponame2>.git
imperfect-fourth commented 2 years ago

The way things are being done right now is that we have a custom checkout hook in our plugin which handles the checkout by taking the information from the configuration(url and ref). But, according to buildkite documentation for the checkout hook, if there are multiple checkout hooks present then only the first one is run.

So the solution suggested above will be hard to implement, since each will create a separate checkout hook but only the first would be run. I would suggest that we do it something like smooth-secrets where an array of secrets configuration(secrets) is provided under the same plugin definition. So it would look something like this

steps:
  - command: echo "Checks out multiple repositories"
    plugins:
      - hasura/smooth-checkout#v2.0.0:
          repos:
            - config:
              - url: git@git-mirror.internal:<username>/<reponame1>.git
              - url: git@github.com:<username>/<reponame1>.git
            - config:
              - url: git@github.com:<username>/<reponame2>.git
                ref: main
scriptnull commented 2 years ago

Ah! Nice catch about the usage of multiple checkout hooks. The YAML that you proposed looks good. (additionally, it may help us to re-use our mirroring logic to the fullest) :+1: :shipit: