Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding compose env for local builds #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zzak
Copy link
Member

@zzak zzak commented Sep 3, 2024

Now we can write this very simple pipeline for debugging builds locally.

Buildkite::Builder.pipeline do
  require "buildkite_config"
  use Buildkite::Config::BuildContext
  use Buildkite::Config::DockerBuild
  use Buildkite::Config::RakeCommand
  use Buildkite::Config::RubyGroup

  plugin :docker_compose, "docker-compose#v4.16.0"
  plugin :artifacts, "artifacts#v1.9.3"

  build_context.setup_rubies %w(3.3)

  group do
    label "build"
    build_context.rubies.each do |ruby|
      builder ruby, compose: {
        "cli_version": "2",
        "image-name": "buildkite_base",
        "cache-from": ["buildkite_base"],
        "push": "",
        "image-repository": "",
      }
    end
  end

  build_context.rubies.each do |ruby|
    ruby_group ruby do
      rake "actioncable", task: "test:integration", retry_on: { exit_status: -1, limit: 3 }, compose: {
        "cli_version": "2",
        "pull": "",
      }, env: {
        "IMAGE_NAME": "buildkite_base",
      }
    end
  end
end

I needed this to run builds on a local VM, where I don't have access to a docker image host and a newer version of docker/compose.

Now we can write this very simple pipeline for debugging builds locally.

```ruby
Buildkite::Builder.pipeline do
  require "buildkite_config"
  use Buildkite::Config::BuildContext
  use Buildkite::Config::DockerBuild
  use Buildkite::Config::RakeCommand
  use Buildkite::Config::RubyGroup

  plugin :docker_compose, "docker-compose#v4.16.0"
  plugin :artifacts, "artifacts#v1.9.3"

  build_context.setup_rubies %w(3.3)

  group do
    label "build"
    build_context.rubies.each do |ruby|
      builder ruby, compose: {
        "cli_version": "2",
        "image-name": "buildkite_base",
        "cache-from": ["buildkite_base"],
        "push": "",
        "image-repository": "",
      }
    end
  end

  build_context.rubies.each do |ruby|
    ruby_group ruby do
      rake "actioncable", task: "test:integration", retry_on: { exit_status: -1, limit: 3 }, compose: {
        "cli_version": "2",
        "pull": "",
      }, env: {
        "IMAGE_NAME": "buildkite_base",
      }
    end
  end
end
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant