Class: Everywhere::Commands::PlatformRunner

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/everywhere/commands/platform/runner.rb

Overview

every platform runner — runs ON a build runner (a GitHub Actions macOS machine, or any Mac). It's the glue between the Runner API and the every release signing engine:

job spec → mark running → download+extract snapshot → pull JIT creds into
a throwaway keychain (+ .p8) → every release (streaming logs) → upload the
artifact + release.json → complete.

Authenticated with the per-artifact runner token, so it can only touch the one artifact it was dispatched for.

Instance Method Summary collapse

Instance Method Details

#call(artifact:, token:, url: nil, shell_dir: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/everywhere/commands/platform/runner.rb', line 33

def call(artifact:, token:, url: nil, shell_dir: nil, **)
  base = Everywhere::Platform::Client.base_url(url)
  @client = Everywhere::Platform::Client.new(base, token: token)
  @artifact = artifact

  job = get!("/runner/artifacts/#{artifact}")
  patch!("/runner/artifacts/#{artifact}", status: "running")
  remote_log("runner: picked up #{job.dig("target", "os")}-#{job.dig("target", "arch")} for #{job.dig("app", "name")}")

  Dir.mktmpdir("every-runner") do |work|
    src = fetch_snapshot(work, job)
    signing_env = pull_credentials(work)

    status, release_json, zip = run_release(src, job, signing_env, shell_dir)

    if status == "succeeded" && zip
      complete_success(zip, release_json)
    else
      complete_failure("build failed — see log")
    end
  ensure
    restore_keychains
  end
rescue Everywhere::Error => e
  complete_failure(e.message)
  UI.die!(e.message)
end