Simplify the builders configuration
1. Add driver as an option, defaulting to `docker-container`. For a
"native" build you can set it to `docker`
2. Set arch as a array of architectures to build for, defaulting to
`[ "amd64", "arm64" ]` unless you are using the docker driver in
which case we default to not setting a platform
3. Remote is now just a connection string for the remote builder
4. If remote is set, we only use it for non-local arches, if we are
only building for the local arch, we'll ignore it.
Examples:
On arm64, build for arm64 locally, amd64 remotely or
On amd64, build for amd64 locally, arm64 remotely:
```yaml
builder:
remote: ssh://docker@docker-builder
```
On arm64, build amd64 on remote,
On amd64 build locally:
```yaml
builder:
arch:
- amd64
remote:
host: ssh://docker@docker-builder
```
Build amd64 on local:
```yaml
builder:
arch:
- amd64
```
Use docker driver, building for local arch:
```yaml
builder:
driver: docker
```
This commit is contained in:
committed by
Donal McBreen
parent
cffb6c3d7e
commit
56268d724d
@@ -14,45 +14,29 @@ class ConfigurationBuilderTest < ActiveSupport::TestCase
|
||||
}
|
||||
end
|
||||
|
||||
test "multiarch?" do
|
||||
assert_equal true, config.builder.multiarch?
|
||||
end
|
||||
|
||||
test "setting multiarch to false" do
|
||||
@deploy_with_builder_option[:builder] = { "multiarch" => false }
|
||||
|
||||
assert_equal false, config_with_builder_option.builder.multiarch?
|
||||
end
|
||||
|
||||
test "local?" do
|
||||
assert_equal false, config.builder.local?
|
||||
assert_equal true, config.builder.local?
|
||||
end
|
||||
|
||||
test "remote?" do
|
||||
assert_equal false, config.builder.remote?
|
||||
end
|
||||
|
||||
test "remote_arch" do
|
||||
assert_nil config.builder.remote_arch
|
||||
end
|
||||
|
||||
test "remote_host" do
|
||||
assert_nil config.builder.remote_host
|
||||
test "remote" do
|
||||
assert_nil config.builder.remote
|
||||
end
|
||||
|
||||
test "setting both local and remote configs" do
|
||||
@deploy_with_builder_option[:builder] = {
|
||||
"local" => { "arch" => "arm64" },
|
||||
"remote" => { "arch" => "amd64", "host" => "ssh://root@192.168.0.1" }
|
||||
"arch" => [ "amd64", "arm64" ],
|
||||
"remote" => "ssh://root@192.168.0.1"
|
||||
}
|
||||
|
||||
assert_equal true, config_with_builder_option.builder.local?
|
||||
assert_equal true, config_with_builder_option.builder.remote?
|
||||
|
||||
assert_equal "amd64", config_with_builder_option.builder.remote_arch
|
||||
assert_equal "ssh://root@192.168.0.1", config_with_builder_option.builder.remote_host
|
||||
|
||||
assert_equal "arm64", config_with_builder_option.builder.local_arch
|
||||
assert_equal [ "amd64", "arm64" ], config_with_builder_option.builder.arches
|
||||
assert_equal "ssh://root@192.168.0.1", config_with_builder_option.builder.remote
|
||||
end
|
||||
|
||||
test "cached?" do
|
||||
|
||||
@@ -90,10 +90,8 @@ class ConfigurationValidationTest < ActiveSupport::TestCase
|
||||
|
||||
test "builder" do
|
||||
assert_error "builder: unknown key: foo", builder: { "foo" => "bar" }
|
||||
assert_error "builder/remote: should be a hash", builder: { "remote" => true }
|
||||
assert_error "builder/remote: unknown key: foo", builder: { "remote" => { "foo" => "bar" } }
|
||||
assert_error "builder/local: unknown key: foo", builder: { "local" => { "foo" => "bar" } }
|
||||
assert_error "builder/remote/arch: should be a string", builder: { "remote" => { "arch" => [] } }
|
||||
assert_error "builder/remote: should be a string", builder: { "remote" => { "foo" => "bar" } }
|
||||
assert_error "builder/arch: should be an array or a string", builder: { "arch" => {} }
|
||||
assert_error "builder/args: should be a hash", builder: { "args" => [ "foo" ] }
|
||||
assert_error "builder/cache/options: should be a string", builder: { "cache" => { "options" => [] } }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user