JetBrains Space Help

Jobs and Steps

Jobs and steps DSL

The most basic Automation unit is the step. A step is the smallest possible building block of the automation script, and it answers two questions: What to run (e.g., a shell script or Kotlin code) and where to run it? You cannot use steps on their own, but only as parts of larger Automation entities, such as jobs, for example.

A job is a defined task consisting of steps. The simplest automation script consists of a single job and, in turn, the simplest job consists of a single step.

Main features of jobs and steps

  1. You can run steps in the following environments: Space cloud workers (virtual machines hosted in Space cloud), self-hosted workers (self-hosted machines), and Docker containers inside workers. Depending on the run environment, you should define steps using either the host or container blocks. To define a job, you should use the job block.

    For example:

    job("Example") { // run the job in a default instance in cloud requirements { workerPool = WorkerPools.SPACE_CLOUD } host("Run echo") { shellScript { content = """ echo "Hello from worker!" """ } } container(displayName = "Say Hello", image = "ubuntu") { shellScript { content = """ echo Hello from container inside worker! """ } } }
  2. A job run is triggered by a project event. By default, it's 'git push'. You can also run jobs manually.

  3. All jobs within a script run in parallel.

  4. Steps within a job can be run in sequence and in parallel.

  5. A job can have specific failure conditions.

  6. A script can contain up to 100 jobs and each job can contain up to 50 steps.

  7. The default and maximum allowed job timeout is 2 hours.

Last modified: 19 May 2023