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 gradle build in a gradle:latest Docker container:

job("example") { container("gradle: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 with the installed Space plugin. The latter is recommended as the plugin provides automatic code completion and code inspections for DSL scripts.

Local reproducibility (planned)

The important thing about automation scripts is that you can run them locally on your machine. This lets you test the script before "pushing" it to the Space server. To run the script locally, you can use:

  • Intellij IDEA with the Space plugin

  • (Not yet available) Space Automation command-line tool

Main concepts

step

Step is the smallest possible building block in Automation. It describes:

  • what must be run: a command, a shell script, a Kotlin script, and so on

  • and where it must be run: in a container, in a virtual machine (not yet supported), or in a function (not yet supported).

You can use steps in jobs, pipeline stages, and deployment scripts.

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. Unlike pipeline stages, it is not possible to create a chain of dependent jobs. All jobs within one script always run in parallel.

Learn more | See DSL

pipeline Not yet available
Pipeline is a linear sequence of stages.
pipeline stage

Not yet available
Stage is a building block for pipelines. As well as job, stage may contain any number of steps. But in contrast to jobs, stages:

  • run sequentially one after another

  • can be dependent on each other (see gate)

  • cannot be triggered by external events

pipeline gate Not yet available
Gate specifies a condition that must be met in order to run the next stage.
deployment target Not yet available
It is a destination target for a deployment script. For example, it could be a staging, pre-prod, or production server.
deployment target health Not yet available
Each deployment target has a health status that you can check in your script. If the check fails, you can run a separate rollback script.
Last modified: 03 September 2020