buildkite-plugins / docker-compose-buildkite-plugin

🐳⚡️ Run build scripts, and build + push images, w/ Docker Compose
MIT License
171 stars 138 forks source link

Add run-image option #430

Closed jquick closed 6 months ago

jquick commented 6 months ago

One final addition!

We have ran into this case a few times where one of the following happens:

For these cases we can inject an:

buildkite-agent meta-data set docker-compose-plugin-built-image-tag*

before running but I think an official option would be helpful.

This PR adds a new run-image option where you can pass an image and it will try to run with it.

An example:

  - label: ":docker: Build (multiplatform)"
    command: >-
      docker buildx build
      --target build
      --platform "linux/amd64,linux/arm64"
      --build-arg BUILDKIT_INLINE_CACHE=1
      --cache-from "${DOCKER_BUILD_BASE}/example/build:unstable-multi"
      -t "${DOCKER_BUILD_BASE}/example/build:${CI_BUILD_ID}"
      example/ 

  - label: ":golang: Test"
    command: go test -v ./...
    plugins:
      - ${DOCKER_COMPOSE_PLUGIN}:
          run: build
          run-image: ${DOCKER_BUILD_BASE}/example/build:${CI_BUILD_ID}
jquick commented 6 months ago

Thanks @toote! I updated with your suggestions and it looks good! Screenshot 2024-02-29 at 7 03 13 PM

Did some testing with and without the override and I am happy with the results. Appreciate the feedback and guidance!