Skip to content

v2.0.0 (🌧Rainy day)

Compare
Choose a tag to compare
@lox lox released this 23 Oct 21:33
· 418 commits to master since this release
5edf992

The first major release since 1.0 🎉 Buildkite Docker Plugin v2.0.0 includes some major improvements, and some breaking changes.

🆙 Upgrading

To upgrade your steps from v1 of the plugin:

  • Rename mounts to volumes and include .:/workdir if you want the behaviour of mounting in the checkout directory to your container.
  • If you were using shell invocations in your commands (e.g /bin/bash -c "echo hello") you can remove them (e.g. echo blah)
  • Specifying shell as a string is no longer supported, and needs to be changed to use the array syntax.

🐢 Improved Shell Handling (New)

This plugin can now run multi-command steps by default. It does this by running commands via a shell—the default shell is /bin/sh -e -c for *nix and CMD.EXE /c for Windows.

steps:
  - command:
      - "yarn install"
      - "yarn run test"
    plugins:
      - docker#v2.0.0:
          image: "node:7"
          always-pull: true

This also means if your commands include bash-ism's, like make && make publish, this will also just work, instead of failing with a cryptic Docker failure message.

If you want to skip the shell—for example if you have a custom entrypoint in your image—we've added a command option (vs the command at the Buildkite step level) that takes an array of parameters. This is handy for shell-less, single binary images, and allows for very precise control of what arguments are passed to the docker run invocation.

For example, the following command uses the mesosphere/awscli Docker image to fetch files from S3 and upload them to Buildkite as artifacts:

steps:
  - plugins:
      docker#v2.0.0:
        image: "mesosphere/aws-cli"
        always-pull: true
        command: ["s3", "sync", "s3://my-bucket/dist/", "/app/dist"]
        volumes: [ "./:/app" ]
    artifact_paths: "dist/**"

Specifying shell as a string is no longer supported. You need to use the array syntax now.

🏆 Automatic Windows shell support (New)

Windows Docker images are now better supported, with the new shell behaviour auto-detecting Windows and setting the shell option to CMD.exe /c. To use PowerShell, set the shell option to [ "powershell", "-Command" ].

steps:
  - command: "dotnet publish -c Release -o published"
    plugins:
      - docker#v2.0.0:
          image: "microsoft/dotnet:latest"
          always-pull: true

📚 mounts is now volumes (Changed)

The previous mounts option is now called volumes to match standard Docker naming, and no longer mounts the build directory into the container if any volumes value is set.
If you provide a list of mounts, you can mount in the working directory by adding .:/work to the list of mounts:

steps:
  - commands:
      - "docker build . -t image:tag"
      - "docker push image:tag"
    plugins:
      docker#v2.0.0:
        image: "docker:latest"
        always-pull: true
        volumes:
          - ".:/app"
          - "/var/run/docker.sock:/var/run/docker.sock"
        workdir: /app

Setting volumes also disables the default workdir setting, so be sure to set one if you need.

👜 workdir has been simplified (Changed)

The previous workdir option would control both mounting the build directory, and setting the container's working directory, which was different to how the standard Docker workdir option behaved.
The plugins workdir option now just sets the working directory of the container, and all volume mounting settings are done via the new volumes option.

Full Changelog

  • Add a command parameter and support arrays for command and shell #68 (@lox)
  • On windows and macOS, mount-buildkite-agent defaults to false #76 (@lox)
  • On windows the default shell is CMD.EXE /c #76 (@lox)
  • Rename parameter mounts to volumes to be inline with docker terminology #72 (@lox)
  • Allow mounts to be explicitly disabled #71 (@lox)
  • Skip mounting the current checkout dir if custom mounts are provided #69 (@lox)