JetBrains Space Help

Automation Tips

Take full advantage of Space automation features, and boost your productivity.

Create your first Automation job

Want to use Space Automation, but not sure how to start? A "hello world" automation script is just a click away!

To work with Space Automation, a .script.kts file has to be added to your repository. This file describes the automation jobs for your project, and the steps that are run as part of your CI/CD process.

From a project's jobs, click Create .space.kts file and get a "hello world" job created!

job("Hello world") { container("hello-world") }

The editor sidebar shows many examples that help with common automation scenarios, such as running Gradle builds, .NET builds, Docker image creation, and more.

Pick what works for your application, and commit the file from your browser. Space Automation will validate the script, and run your first automation job.

More about getting started with Space Automation...

Use IntelliJ IDEA to write Space Automation scripts

Automation scripts are Kotlin-based. Use an IDE to create and refactor your builds!

That .space.kts file in your repository describes automation jobs... and it's Kotlin! Install the Space plugin into your JetBrains IDE, and enjoy the power of code completion, syntax highlighting, and more!

As an example, you can move common logic into functions. Need to send a chat message after build completes? Write a function for it, or use the Extract method refactoring to move existing script code into a separate function.

Here's a bonus tip! Have a look at this example of using @file:DependsOn() to reference an external library and get even more power in your automation!

More about the Space plugin...

Use IntelliJ IDEA to view job status in the Git log

See the result of your Automation job from within your IDE!

View automation job status in Git log

As part of your Continuous Integration (CI) process, every commit and every merge request can be validated by Space Automation. It lets you build, test, and deploy your projects.

You can track an automation job’s progress. In the Log tab of the Git tool window, you can see icons that represent the status of a job. When you click the icon, the IDE shows you more information about the jobs that were executed, their status, and whether external checks were performed.

If you don't need the status information, click the icon above the log and selecting Show Columns | Space Automation.

More about the Space plugin...

Running things with Automation - job steps

Automation runs jobs, and jobs have one or more steps. Let's see what those steps can do!

A .script.kts file defines one or more Jobs. Each Job can run one or more Steps. Jobs are triggered by events, such as Git push or when a code review is opened.

Job steps run in an environment, which can be a container, a virtual machine (not yet available) or as a function (not yet available).

In a container, you can run:

  • Shell scripts, using shellScript { }

  • Kotlin code, using kotlinScript { }

  • Container commands, such as entrypoint() and args()

  • Language- and framework-specific commands, that can run Gradle, .NET or Docker image builds

Many examples can be found here.

More about jobs and steps in Space Automation...

Get notified when the build breaks

How do you know when an Automation job goes wrong? Subscribe to notifications!

In Space, you can see an overview of current and previous automation job executions. You can check details for each job, look at their status, and dive into the logs when needed.

But how do you stay informed without having to check manually? This is where notifications come in.

Subscribe to those notifications you are interested in. Want to get pinged when a job runs? Or only when a job fails? For your commits only, or for everybody on the team? The choice is yours.

Sit back and relax while your CI/CD runs, a message will come from Space when it matters to you.

More about chat and notifications in Space...

Last modified: 09 September 2021