api/README.md

1.6 KiB

Remote execution

Currently remote execution only applies to execution of modules in container. Theoretically it could also be used e.g. to execute modules on other machines via SCP/SSH.

Sequence diagram overview

The following sequence diagram illustrates the remote protocol:

sequenceDiagram
    client ->>+ executor: StartTaskRequest
    client ->> client: listen for executor events
    executor ->> executor: Start FS watcher
    executor ->> executor: Unmarshal task and execute
    
    loop stream task output & logs
        executor -->> client: TaskLog
        executor -->> client: TaskOutput
    end

    executor -->>- client: TaskResult - as soon as execution completes

Execution steps for container tasks

The overall execution looks like this:

  1. create container network
  2. create container
  3. copy buildr binary, tools and content into container
    • if input mapping is configured, content is copied as it would be mapped
    • if no input mapping is configured complete repository is copied
  4. start container with buildr as entrypoint (gRPC server)
  5. connect to gRPC server
  6. send StartTaskRequest specifying what to do - although it's called TaskRequest it could be any module
  7. server starts a FS watcher to monitor modified files
  8. buildr CLI listens for logs and output from executed task
  9. as soon as the execution completes, modified files are collected into a .tar.s2 file and error message + location of the archive are sent as result to buildr CLI
  10. CLI copies archive back and extracts modified files to output directory