generated from marked/CSSharpTemplate
Initial commit
This commit is contained in:
commit
a44fe0dbe0
20 changed files with 1237 additions and 0 deletions
41
lune/manager/replicators/ssh-docker.luau
Normal file
41
lune/manager/replicators/ssh-docker.luau
Normal file
|
@ -0,0 +1,41 @@
|
|||
--!strict
|
||||
local process = require("@lune/process")
|
||||
|
||||
local common = require("../common")
|
||||
local result = require("@pkg/result")
|
||||
|
||||
local function ssh_docker_replicator(dist_folder: string, remote_output: string): result.Identity<nil>
|
||||
local split = string.split(remote_output, "->")
|
||||
|
||||
local remote_machine = split[1]
|
||||
if not remote_machine then
|
||||
return result(false, "Couldn't get the remote machine to ssh into.")
|
||||
end
|
||||
|
||||
local docker_path = split[2]
|
||||
if not docker_path then
|
||||
return result(false, "Couldn't get the docker container path for the remote machine.")
|
||||
end
|
||||
|
||||
local ssh_copy_result = process.spawn(
|
||||
"scp",
|
||||
{ "-r", "-O", dist_folder, `{remote_machine}:/tmp/cssharp-replicate` },
|
||||
{ stdio = "forward" }
|
||||
)
|
||||
if not ssh_copy_result.ok then
|
||||
return result(false, `Failed to copy files to the remote machine:\n{ssh_copy_result.stderr}`)
|
||||
end
|
||||
|
||||
local docker_copy_result = process.spawn(
|
||||
"ssh",
|
||||
{ "-t", remote_machine, `"docker cp -r /tmp/cssharp-replicate {docker_path}"` },
|
||||
{ stdio = "forward" }
|
||||
)
|
||||
if not docker_copy_result.ok then
|
||||
return result(false, `Failed to copy files via docker on the remote machine:\n{docker_copy_result.stderr}`)
|
||||
end
|
||||
|
||||
return result(true, nil)
|
||||
end
|
||||
|
||||
return ssh_docker_replicator :: common.Replicator
|
Loading…
Add table
Add a link
Reference in a new issue