# Non-agent hook method of disabling the cloning/submodule update into working directory

**URL:** <https://forum.buildkite.community/t/non-agent-hook-method-of-disabling-the-cloning-submodule-update-into-working-directory/764>\
**Category:** Features Requests\
**Created:** [October 24, 2019, 3:32pm UTC](https://forum.buildkite.community/t/non-agent-hook-method-of-disabling-the-cloning-submodule-update-into-working-directory/764 "2019-10-24T15:32:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan.pierce](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/nathan.pierce/32/393_2.png) [@nathan.pierce](https://forum.buildkite.community/u/nathan.pierce)\
**Post date:** [October 24, 2019, 3:32pm UTC](https://forum.buildkite.community/t/non-agent-hook-method-of-disabling-the-cloning-submodule-update-into-working-directory/764/1 "2019-10-24T15:32:48Z")

</div>

RE: [How do I skip the "Preparing Working Directory" step?](https://forum.buildkite.community/t/how-do-i-skip-the-preparing-working-directory-step/468)

Problem: We’re cloning the entire repo and then doing submodule checkout just to get a specific file/folder for CI/CD scripts. The clone/submodule actions performed are outside of our control unless we disable it in the agent’s hooks, but, we are extremely uncomfortable with this solution (see the URL/discussion above). It delays the pipeline execution by several minutes depending on various factors like networking between us and GitHub, the size of the repo, etc.

Solution: Have a top-level boolean key in each YAML block/step which disables the clone/submodule stuff entirely. It needs to still create an empty directory since we, in the commands list in the YAML, do the download of the pipeline.yml or a sparse checkout instead of the clone.

Example of what we do now:

```auto
steps:
  - wait

  - label: ":pipeline: Generate Pipeline Steps"
    command:
      - "./.cicd/generate-pipeline.sh > generated-pipeline.yml"
      - "buildkite-agent pipeline upload < generated-pipeline.yml"
      - "buildkite-agent artifact upload generated-pipeline.yml"
    agents:
      queue: "automation-basic-builder-fleet"
    timeout: ${TIMEOUT:-10}

```

What we’d like to do:

```auto
steps:
  - wait

  - label: ":pipeline: Generate Pipeline Steps"
    prep-working-directory: false
    command:
      - "git clone --depth 1 --no-checkout --filter=blob:none $BUILDKITE_REPO cloned-repo"
      - "cd cloned-repo && git checkout $BUILDKITE_COMMIT -- .cicd"
      - "./.cicd/generate-pipeline.sh > generated-pipeline.yml"
      - "buildkite-agent pipeline upload < generated-pipeline.yml"
      - "buildkite-agent artifact upload generated-pipeline.yml"
    agents:
      queue: "automation-basic-builder-fleet"
    timeout: ${TIMEOUT:-10}

```

The time savings for this should end up being ~1 minute for our pipelines on average, which regardless of how it looks actually ends up being a lot of money and time in a week.

---

<div class="post-metadata">

**Author:** ![SeanR](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/seanr/32/340_2.png) [@SeanR](https://forum.buildkite.community/u/SeanR)\
**Post date:** [October 25, 2019, 10:26am UTC](https://forum.buildkite.community/t/non-agent-hook-method-of-disabling-the-cloning-submodule-update-into-working-directory/764/2 "2019-10-25T10:26:31Z")

</div>

Not 100% sure if it meets your use case, but I believe that’s what [this plugin](https://github.com/thedyrt/skip-checkout-buildkite-plugin) is intended to do.
