Skip to content

Plugin to set BUILDKITE_GIT_* Flags. This can improve build performance by implementing shallow clones or controlling `git` configs using flags to suite your usecase.

Notifications You must be signed in to change notification settings

whizzzkid/git-flags-buildkite-plugin

 
 

Repository files navigation

Git flags Buildkite Plugin

Github Workflow (CI) GitHub tag (latest by date)

Sets the Buildkite git flags for the current build. This can be useful to customize the behavior of the git commands used by Buildkite.

Example

Add the following to your pipeline.yml (all flags are optional and update the corresponding flags in your pipeline:

steps:
  - command: ls
    plugins:
      - whizzzkid/git-flags#<latest_tag>:
          clean_flags: "-ffxdq"
          clone_flags: "--depth=1"
          clone_mirror_flags: "--mirror"
          fetch_flags: "--depth=1"
          mirrors_lock_timeout: 100
          mirrors_path: "~/new/path"
          mirrors_skip_update: "false"

If you're using buildkite-builder, then you can introduce the plugin like:

Buildkite::Builder.pipeline do
  # ...
  # other setups
  # ...
  plugin :shallow_clone, 'ssh://[email protected]/whizzzkid/git-flags-buildkite-plugin.git#<latest-tag>', {
    clone_flags: '--single-branch --depth 1',
    fetch_flags: '--depth 1'
  }
  # then int the command step
  command do
    label 'Do Something'
    # ... command config
    plugin :shallow_clone
  end
end

Note

Don't forget to replace <latest-tag> with a corresponding tag from the releases.

Configuration

clean_flags (Optional, string)

Git clean flags, e.g. "-ffxdq". Supports any pattern supported by git-clean. Corresponding Buildkite documentation can be found here.

clone_flags (Optional, string)

Git clone flags, e.g --depth=1. Supports any pattern supported by git clone. Corresponding Buildkite documentation can be found here

fetch_flags (Optional, string)

Git fetch flags, e.g --all. Supports any pattern supported by git fetch. Corresponding Buildkite documentation can be found here

clone_mirror_flags (Optional, string)

Buildkite clone mirror flags, e.g --mirror. Corresponding Buildkite documentation can be found here

mirrors_lock_timeout (Optional, number)

Buildkite mirror lock timeout, e.g 100, default 300. Corresponding Buildkite documentation can be found here

mirrors_path (Optional, string)

Buildkite mirrors path, e.g ~/new/path. Corresponding Buildkite documentation can be found here

mirrors_skip_update (Optional, boolean)

Buildkite skip mirrors update, e.g true. Corresponding Buildkite documentation can be found here.

Developing

To run the tests:

docker-compose run --rm tests

Contributing

  1. Fork the repo
  2. Make the changes
  3. Run the tests
  4. Commit and push your changes
  5. Send a pull request

About

Plugin to set BUILDKITE_GIT_* Flags. This can improve build performance by implementing shallow clones or controlling `git` configs using flags to suite your usecase.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%