Space logo

Space

The intelligent code collaboration platform

Space is pivoting to SpaceCode, focused on Git hosting and code reviews. Learn more →

News Remote Development

Configure Space Dev Environment Warm-ups with Devfile.yaml

Configure Space Dev Environment Warm-ups with Devfile.yaml

One of the advantages of using Space dev environments is eliminating the need for an IDE warm-up phase, which can take up valuable time. With Space, you speed up the dev environment startup by creating a warm-up snapshot that contains project indexes and other data like project dependencies.

Today, we’re introducing changes to the configuration of warm-ups and disabling dev environment warm-up via Space Automation. You can now set up the warm-up in the project devfile.yaml, along with other dev environment settings.

Keep reading to learn what has changed and how to configure dev environment warm-ups with devfile.yaml.

Changes introduced to warm-up configuration

Before the latest update, the only way to get a warm-up snapshot was to run a special Space Automation (CI/CD) job. That was quite inconvenient, as it required setting up Automation for the project and configuring a job in the additional .space.kts file.

That’s no longer the case! You can now set up the warm-up right in the project’s devfile.yaml, along with other dev environment settings.

Regarding available functionality, warm-up in devfile.yaml is just as good as with the old configuration. You can:

The examples below show you how to create a warm-up snapshot with project indexes for IDEA 2023.1 and data created by a ./dev-env-warmup.sh script.

Deprecated way of configuring warm-ups

.space.kts:

job("Warmup data for IDEA") {
    # optional
    startOn {
        // run on schedule from Mon to Fri
        schedule { cron("0 0 * * MON-FRI") }
        // or run on every commit push...
        //gitPush {
            // ...but only to the main branch
            //branchFilter {
           //     +"refs/heads/main"
            //}
        //}
    }

    warmup(ide = Ide.Idea) {
        // path to the warm-up script
        scriptLocation = "./dev-env-warmup.sh"
        // use image specified in the devfile
        devfile = ".space/devfile.yaml"
    }
}

New way of configuring warm-ups

Dev environment configuration including the warm-up is provided in a single devfile.yaml.

.space/devfile.yaml:

schemaVersion: 2.2.0
attributes:
  space:
    editor:
      type: Idea
      version: '2023.1'
    # The warmup will run in the 'my-devenv-container' specified below.
    warmup:
      # The warm-up will run on schedule
      startOn:
      - type: schedule
        cron: '0 0 * * MON-FRI'
      # or on git push to the main branch
      #- type: gitPush
      #  branchFilter:
      #    include:
      #    - 'refs/heads/main'
      script: |
        ./dev-env-warmup.sh
components:
- name: my-devenv-container
  container:
    image: mycompany.registry.jetbrains.space/p/myprj/container/dev-image:latest

Actions you should take 

We are disabling warm-up via Automation, and the related jobs will no longer run. Don’t worry though – you can still use the warm-up snapshots created with this method. To keep your warm-up snapshots up to date, you should move the corresponding configuration from Automation to devfile.yaml as soon as possible.

As always, don’t hesitate to leave your feedback. Let us know in the comments below how you like the new warm-up configuration method or if you have any questions.

image description