JetBrains Space Help

Automation Concepts

Space Automation

What is Space Automation?

The main purpose of Automation is CI/CD: Using the script file stored in the project repository, you can build, test, and deploy the project.

Configuration as code

Scripts are the only way to configure Automation. The Automation UI you see in Space is used only to visualize script results: logs, tests, artifacts, etc. Scripts are written with a special DSL (domain-specific language).

Kotlin-based DSL

The DSL is based on Kotlin programming language, so you can use Kotlin data types and language structures right inside your automation script.

For example, a simple script that runs gradlew build in the ubuntu:latest Docker container:

job("Run gradlew build") { container(image = "ubuntu:latest") { shellScript { content = "./gradlew build" } } }

Automation script

The automation script must be stored in the .space.kts file in the root directory of a project. To edit .space.kts, you can use either Space code web-editor or IntelliJ IDEA. The latter is recommended as IDEA provides automatic code completion and code inspections for DSL scripts.

Note that there can be only one .space.kts file in a project repository.

Main concepts

step

Step is the main building block in Automation. It describes:

  • what must be run: a command, a shell script, or Kotlin code.

  • and where it must be run:

    • in a host machine (worker) – host steps

    • or in a container inside a worker – container steps

Learn more | See DSL

job

Job is a defined task consisting of steps. The simplest automation script consists of one job which, in turn, consists of one step. Note that it is not possible to create a chain of dependent jobs. All jobs within one script always run in parallel.

Learn more | See DSL

worker

A host machine that runs your Automation jobs. There are two types of workers: cloud workers provided by Space (virtual machines) and self-hosted workers – workers that you can set up and run on your own infrastructure.

Learn more

deployment

A process of delivering source code changes to a deployment environment (deployment target).

Learn more

deployment target

It is a destination target for a deployment. For example, it could be a staging, pre-production, or a production server.

Last modified: 15 December 2023