-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #921 from basecamp/remote-hybrid-builders-cleanup
Build and clean remote builders correctly
- Loading branch information
Showing
12 changed files
with
101 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,6 +119,9 @@ class CliBuildTest < CliTestCase | |
SSHKit::Backend::Abstract.any_instance.expects(:execute) | ||
.with(:docker, "--version", "&&", :docker, :buildx, "version") | ||
|
||
SSHKit::Backend::Abstract.any_instance.expects(:execute) | ||
.with(:docker, :buildx, :rm, "kamal-local-docker-container") | ||
|
||
SSHKit::Backend::Abstract.any_instance.expects(:execute) | ||
.with(:docker, :buildx, :create, "--name", "kamal-local-docker-container", "--driver=docker-container") | ||
|
||
|
@@ -210,16 +213,25 @@ class CliBuildTest < CliTestCase | |
test "create remote" do | ||
run_command("create", fixture: :with_remote_builder).tap do |output| | ||
assert_match "Running /usr/bin/env true on 1.1.1.5", output | ||
assert_match "docker context create kamal-remote-docker-container-ssh---app-1-1-1-5 --description 'kamal-remote-docker-container-ssh---app-1-1-1-5 host' --docker 'host=ssh://[email protected]'", output | ||
assert_match "docker buildx create --name kamal-remote-docker-container-ssh---app-1-1-1-5 kamal-remote-docker-container-ssh---app-1-1-1-5", output | ||
assert_match "docker context create kamal-remote-ssh---app-1-1-1-5-context --description 'kamal-remote-ssh---app-1-1-1-5 host' --docker 'host=ssh://[email protected]'", output | ||
assert_match "docker buildx create --name kamal-remote-ssh---app-1-1-1-5 kamal-remote-ssh---app-1-1-1-5-context", output | ||
end | ||
end | ||
|
||
test "create remote with custom ports" do | ||
run_command("create", fixture: :with_remote_builder_and_custom_ports).tap do |output| | ||
assert_match "Running /usr/bin/env true on 1.1.1.5", output | ||
assert_match "docker context create kamal-remote-docker-container-ssh---app-1-1-1-5-2122 --description 'kamal-remote-docker-container-ssh---app-1-1-1-5-2122 host' --docker 'host=ssh://[email protected]:2122'", output | ||
assert_match "docker buildx create --name kamal-remote-docker-container-ssh---app-1-1-1-5-2122 kamal-remote-docker-container-ssh---app-1-1-1-5-2122", output | ||
assert_match "docker context create kamal-remote-ssh---app-1-1-1-5-2122-context --description 'kamal-remote-ssh---app-1-1-1-5-2122 host' --docker 'host=ssh://[email protected]:2122'", output | ||
assert_match "docker buildx create --name kamal-remote-ssh---app-1-1-1-5-2122 kamal-remote-ssh---app-1-1-1-5-2122-context", output | ||
end | ||
end | ||
|
||
test "create hybrid" do | ||
run_command("create", fixture: :with_hybrid_builder).tap do |output| | ||
assert_match "Running /usr/bin/env true on 1.1.1.5", output | ||
assert_match "docker buildx create --platform linux/#{Kamal::Utils.docker_arch} --name kamal-hybrid-docker-container-ssh---app-1-1-1-5 --driver=docker-container", output | ||
assert_match "docker context create kamal-hybrid-docker-container-ssh---app-1-1-1-5-context --description 'kamal-hybrid-docker-container-ssh---app-1-1-1-5 host' --docker 'host=ssh://[email protected]'", output | ||
assert_match "docker buildx create --platform linux/#{Kamal::Utils.docker_arch == "amd64" ? "arm64" : "amd64"} --append --name kamal-hybrid-docker-container-ssh---app-1-1-1-5 kamal-hybrid-docker-container-ssh---app-1-1-1-5-context", output | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
service: app | ||
image: dhh/app | ||
servers: | ||
web: | ||
- "1.1.1.1" | ||
- "1.1.1.2" | ||
workers: | ||
- "1.1.1.3" | ||
- "1.1.1.4" | ||
registry: | ||
username: user | ||
password: pw | ||
|
||
accessories: | ||
mysql: | ||
image: mysql:5.7 | ||
host: 1.1.1.3 | ||
port: 3306 | ||
env: | ||
clear: | ||
MYSQL_ROOT_HOST: '%' | ||
secret: | ||
- MYSQL_ROOT_PASSWORD | ||
files: | ||
- test/fixtures/files/my.cnf:/etc/mysql/my.cnf | ||
directories: | ||
- data:/var/lib/mysql | ||
redis: | ||
image: redis:latest | ||
roles: | ||
- web | ||
port: 6379 | ||
directories: | ||
- data:/data | ||
|
||
readiness_delay: 0 | ||
|
||
builder: | ||
arch: | ||
- arm64 | ||
- amd64 | ||
remote: ssh://[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,6 @@ accessories: | |
port: 6379 | ||
directories: | ||
- data:/data | ||
builder: | ||
arch: amd64 | ||
|
||
readiness_delay: 0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,6 @@ accessories: | |
port: 6379 | ||
directories: | ||
- data:/data | ||
builder: | ||
arch: amd64 | ||
|
||
readiness_delay: 0 | ||
|
||
|