JetBrains Space Help

Get and Set Job Run Number

To help you distinguish one job run from another, Automation assigns a number to every run. By default, the number is auto-incremented starting from 0 and is not unique (there can be two or more runs with the same number).

The run number is shown next to each job run on the project Jobs page.

Script execution number

Get the current job run number

Sometimes, you may need to get the current run number right from the automation script. For example, to generate a version number for the application you develop. You can do this either using the JB_SPACE_EXECUTION_NUMBER variable or the executionNumber() API function:

job("Example") { container("openjdk:11.0.3-jdk") { kotlinScript { api -> println("Build #" + System.getenv("JB_SPACE_EXECUTION_NUMBER")) println("Build #" + api.executionNumber()) } } }

Set the next run number

Setting the exact job run number may be helpful in some cases. For example, when you want to reset the run counter.

  1. Open the desired project.

  2. On the project sidebar menu, choose Jobs.

  3. Click the menu icon next to the required job and choose Change the next job number.

  4. In the opened window, specify the desired value. The next job run will get the specified number.

Last modified: 31 August 2020