Get Started with Automation
All you need to start your work with Automation is simply create a .space.kts file in the project root and put at least one job
into it.
To set up Automation for a project
Open or create the project you want to automate.
Add the .space.kts file to the project repository:
On the project side-bar menu, choose Jobs.
Click Create .space.kts. The file will be automatically added to the project root directory.
By default, the created .space.kts file already contains the 'Hello world' automation script:
job("Hello world") { container(displayName = "Say hello", image = "hello-world") }All this script does is run a Docker container with the 'hello-world' image.By default, a
job
is triggered by any commit that is pushed to the project repository. As Space added the file to the project through the 'git push', this triggered our "Hello world" job. Let's take a look at script run results:On the project side bar menu, choose Jobs.
In the list of jobs, choose Hello world.
What's next. Learn the basics of Automation
Learn the Automation basics. We recommend that you start with these topics:
Automation building blocks: jobs and steps.
Where can you run Automation jobs? Run environment.
What's next. Use IntelliJ IDEA for writing Automation scripts
One of the ways to edit your Automation scripts is to use the code editor built in Space. It might be not convenient, especially when editing large scripts with complex logic. For such cases, we recommend that you use IntelliJ IDEA or Android Studio. These IDEs come bundled with the Space plugin: among many features the plugin provides support for Automation scripts:
The Space Automation window shows the tree structure of the currently opened
.space.kts
file.Autocompletion of the Automation DSL.
Autocompletion of the
space()
client API – the API that lets you work with other Space modules from Automation scripts.