JetBrains Space Help

Jobs and Steps

Jobs and steps DSL

Job

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.

Step

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 jobs.

Step types

The step type defines the execution environment for the step. There are two types of steps in Automation:

  • host

    • Runs on a virtual machine (worker) in Space Automation cloud or on a self-hosted worker.

    • Lets you run multiple scripts (kotlinScript and shellScript) in a single block. These scripts run sequentially. As they are run on the same machine, they share the same file system.

  • container

    • Runs in a Docker container inside a worker (cloud or self-hosted).

    • Lets you run only one script (kotlinScript and shellScript) in a single 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!" """ } shellScript { content = """ echo "Hello from worker one more time!" """ } } container(displayName = "Say Hello", image = "ubuntu") { shellScript { content = """ echo "I can run shellScript only once!" """ } } }

File system

  • Each step runs in a new environment. This means that each step has its own file system with a fresh copy of the project sources. That's why if you need to run various scripts (e.g., kotlinScript and shellScript) in a single step, prefer using the host step type.

  • You can also share files between steps.

  • Learn more about the file system in a container and in a worker.

Parallel and sequential execution

Job triggers

Limits

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

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

Last modified: 15 December 2023