Jobs

The fundamental unit of work in SaturnCI is a job.

A job runs inside an environment. A job lives in a directory under .saturnci/jobs/ and names the environment it runs in. Here is a job named hello_world:

# .saturnci/jobs/hello_world/hello_world_job.rb

class HelloWorldJob
  def initialize(io: $stdout)
    @io = io
  end

  def perform
    @io.puts "hello world"
  end
end
# .saturnci/jobs/hello_world/config.yml

environment: ruby

Triggering child jobs

A job can trigger one or more child jobs by defining a transition that returns them.

One child job:

# .saturnci/transitions/hello_world_transition.rb

class HelloWorldTransition
  def after(job_run)
    [
      { job_name: "goodbye_world" }
    ]
  end
end

Two child jobs:

# .saturnci/transitions/hello_world_transition.rb

class HelloWorldTransition
  def after(job_run)
    [
      { job_name: "goodbye_world" },
      { job_name: "hello_again" }
    ]
  end
end

The GitHub push

The github_push job is triggered by a webhook that GitHub sends to SaturnCI on every push. Its transition is where you say what should happen on a push. Here it triggers the test_suite job:

# .saturnci/transitions/github_push_transition.rb

class GitHubPushTransition
  def after(job_run)
    [
      {
        task_adapter_name: "rails_rspec",
        job_name: "test_suite",
        job_run_type: "test_suite_run",
      }
    ]
  end
end