Automation Caching
Is there any way of caching parts of a build with Space Automation?
I.e.
- Could I cache a node_modules directory somewhere for re-use in builds?
- Could I use --cache-from when building a docker image using the Kotlin DSL?
Docker --cache-from (after pulling an image) would be immensely useful in a lot of ways. Any process that takes time could be cached based on the input, e.g. installing packages, composer, bundler, npm, compiling dependencies.
Directly caching files such as node_modules could similarly be useful, and might result in pulling fewer docker images. e.g. Gitlab CI
For docker cache in Gitlab, I currently use a script like the below:
image: docker:git
services:
- docker:dind
stages:
- build
variables:
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
build:
stage: build
script:
- docker pull $CONTAINER_IMAGE:latest || true #To use for cache
- docker build --build-arg BUILD_NUMBER=$CI_COMMIT_TAG --cache-from $CONTAINER_IMAGE:latest -t $CONTAINER_IMAGE:$CI_COMMIT_TAG -t $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_COMMIT_TAG
- docker push $CONTAINER_IMAGE:latest
only:
- tags
Please sign in to leave a comment.
I'm wondering the same. I'm currently evaluating both jetbrains space and github. I currently have a jenkins build runner and our build will take at least 30 min. on every commit if I have to do a clean build. I was surprised to find that there are no clean implementations for caching the build data between github workflow runs. There are more complicated ways that are supposed to work, but I haven't had success yet. So far, a bit dissapointed with github actions. If the same issues exist here it looks like I create setup with my locally hosted runner.
According to the below ticket, caching in JetBrains space automation currently not yet available. This feature is reported to be on the roadmap for Q3 2022:
https://youtrack.jetbrains.com/issue/SPACE-10779
You can still use --cache-from in Space automation. I found that using a container(image = "docker:latest") job step is more flexible than the built in docker(..) job step. With the container, I can run any docker shell commands I want. Adding --cache-from cut my step from 20 minutes down to 5.