Pre-checkout. clone another repo

Hi,

I need to checkout another git repo before the main repo checkout.
How do I clone the repo in the pre-checkout stage?

Couldnt find samples for pre-checout.

Thanks

Hey @priju_paul
Do you want to skip the checkout of the configured repository or do you want to still do that, but after you’ve checked out another repository somewhere?
There are a few plugins that can handle skipping the default checkout: Buildkite Plugins

In that list, there is also this one which might serve your purpose: GitHub - hasura/smooth-checkout-buildkite-plugin: All the things you need during a Buildkite checkout.

Have a look over those to see if they fit. You could reach out to the maintainers as well about adding functionality or take inspiration for your own hook.

And if they don’t fit, let us know and we can have a look into more specifics :+1:

Thanks @jarryd . I would want to checkout both the repositories.
Say
“main repo dependency” and main repo. I would want to checkout “main repo dependency” before we check out main repo.

Thanks,

In that case, it looks like the smooth-checkout-buildkite-plugin should be able to do that for you. You can define a list of repos to checkout and it does them in the order defined. It overrides the default checkout so you would have to redefine it, something like this

steps:
  - command: echo "Checks out multiple git repositories"
    plugins:
      - hasura/smooth-checkout#v3.1.0:
          repos:
            - config:
              - url: git@github.com:<username>/<repo_1>.git
                ref: <ref>
            - config:
              # check out the main repo last
              - url: $BUILDKITE_REPO

Thanks @jarryd .

I have added the steps, however i get “:rotating_light: Error: Failed to checkout plugin smooth-checkout: Can’t checkout plugin without a plugins-path

Do we need to add the “plugins-path” as well. I reckon this is the url to smooth-checkout.

Regards

That looks to me like a misconfiguration on the agent. Can you confirm you have a non-empty plugins path option? You can reference the links below to help out.

Docs for plugins-path: Buildkite Agent Configuration v3 | Buildkite Documentation
Error message: agent/bootstrap.go at main · buildkite/agent · GitHub