Skip to content
master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
ci
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

batect

Build Status Coverage CII Best Practices License Chat

build and testing environments as code tool

batect allows you to define your development tasks (building, running, testing, linting and more) in terms of one or more Docker containers, run those tasks quickly and consistently everywhere, and easily share them with your team.

batect is:

  • 🚀 fast: Tasks start quickly due to parallelisation, run quickly thanks to caching, and clean up reliably every time - we've seen 17% quicker execution than Docker Compose.

  • 😌 easy to use: Easily share your development tasks with your whole team, and free them from manual setup of build tools and dependencies for tasks like running your app locally or integration testing. And no installation is required either - just drop the script in your project and batect takes care of the rest.

  • consistent: batect uses Docker to create a clean, isolated environment every time you run a task, freeing you from "works on my machine" issues - including on CI. And you can easily share tasks between projects with bundles.

  • versatile: Anything that can run in a Docker container can be run with batect - builds, unit testing, integration testing, linting, local environments, deployments; frontend, backend or somewhere in between, batect can do it all.

asciicast

Hello World

The simplest possible batect.yml:

containers:
  my-container:
    image: alpine:3.11.3

tasks:
  say-hello:
    description: Say hello to the nice person reading the batect README
    run:
      container: my-container
      command: echo 'Hello world!'

Run it with ./batect say-hello:

$ ./batect say-hello
Running say-hello...
my-container: running echo 'Hello world!'

Hello world!

say-hello finished with exit code 0 in 1.2s.

Get a list of available tasks with ./batect --list-tasks:

$ ./batect --list-tasks
Available tasks:
- say-hello: Say hello to the nice person reading the batect README

Take a look at the sample projects for more examples.

Getting started

  1. Download the latest version of batect and batect.cmd from the releases page, and copy them into your project.

    Note that you only need the scripts - you don't need to download batect.jar.

    The batect and batect.cmd scripts are designed to be committed alongside your project, and not installed globally. Committing them alongside your code improves consistency within your team, as everyone uses the same version of batect. They will automatically pull down the correct version of batect for your operating system.

  2. If you're on Linux or macOS, make sure the script is executable: run chmod +x batect.

  3. Create your batect.yml to define your tasks and the environments they run in:

Requirements

batect requires Docker 18.03.1 or newer, Java 8 or newer (although this requirement will be removed before v1.0), and:

  • On Linux and macOS: Bash and curl
  • On Windows: Windows 10 / Windows Server 2016 or later

batect supports both Linux and Windows containers.

A 64-bit version of Java is required on Windows.

Under the hood

Take a look at the task lifecycle to understand how batect executes tasks.

Documentation

All documentation is available on the documentation site. Highlights include:

Presentations

  • Dockerised local build and testing environments made easy at Container Camp AU (July 2019): video

    Also presented at DevOpsDays Auckland (October 2019), DDD Sydney (September 2019) and DDD Melbourne (August 2019).

  • Build & Testing Environments as Code: Because Life's Too Short Not To at Evolution by ThoughtWorks (June 2018): video, slides

Support and community

There's a batect community on Spectrum - anyone is welcome to join.

Feedback

Please open an issue on GitHub if you run into a problem or have a suggestion.

You can see what new features and improvements are planned in the roadmap.

Contributing

See the contribution guide.

Acknowledgements

Thank you to the following people for their bug reports, pull requests, suggestions and feedback, in alphabetical order:

Thank you to YourKit for providing a complimentary copy of the YourKit profiler, and thank you to JFrog for providing a complimentary instance of both Bintray and Artifactory.

You can’t perform that action at this time.