dockerbamboobamboo-specsconfiguration-as-code

How do I remove the implict 'checkout' task from Bamboo YAML


I am using the Bamboo build system to create and deploy a docker image. I have three stages corresponding to:

  1. Build Docker Image
  2. Tag Image
  3. Deploy Image

In the build stage I am pulling my Dockerfile, and any other dependencies I need to construct the image from git. Then I am building the docker image, which is stored in my local repository.

In the tag and deploy stages, I am performing the obvious tasks using the docker image stored in the build stage.

There is no need to checkout source code in the last two stages- and in fact it should be avoided for various reasons.

Question: Is there a way to avoid having bamboo perform this code checkout in the last two steps?

Leaving the checkout task out of my bamboo.yml is not effective, as bamboo implicitly adds it back in. The best I can seem to do is add the force-clean-build tag set to false, like so:

- checkout:
      force-clean-build: 'false'

Solution

  • Bamboo requires at least one checkout task for job. If you don't need repo checkout try to trick Bamboo with conditional checkout task

      tasks:
      - checkout:
          repository: you-repo
          conditions:
          - variable:
              exists: my.var