What happened:
Currently, build cache scopes are event, pipeline and job.
I'd be nice if download build cache step can be skipped in the specific job for build speed up.
What you expected to happen:
Users can disable build cache in the specific job.
There are some solutions to fix this issue.
This idea is to add new object disable or enable in cache.
cache:
event:
- $SD_SOURCE_DIR/node_modules
pipeline:
- ~/.npm
- test.txt
job:
test: [/tmp/test-dir, /tmp/test.txt]
publish: [publish.txt]
disable:
- job1
- job2
All jobs other than job1 and job2 caches file at this case.
cache:
event:
- $SD_SOURCE_DIR/node_modules
pipeline:
- ~/.npm
- test.txt
job:
test: [/tmp/test-dir, /tmp/test.txt]
publish: [publish.txt]
enable:
- job3
Only job3 caches files at this case.
This idea enables cache level indication.
cache:
event:
- $SD_SOURCE_DIR/node_modules
pipeline:
- ~/.npm
- test.txt
job:
test: [/tmp/test-dir, /tmp/test.txt]
publish: [publish.txt]
disable:
event:
- job2
enable:
pipeline:
- job1
- job3
And we have to handle it as an error; event should not to be put both disable and enable.
disable:
event:
- job2
enable:
event:
- job1
This idea does not set both enable and disable together.
cache:
event:
- $SD_SOURCE_DIR/node_modules
pipeline:
- ~/.npm
- test.txt
job:
test: [/tmp/test-dir, /tmp/test.txt]
publish: [publish.txt]
enable:
pipeline:
- job1
- job3
example:
cache:
event:
- filename: $SD_SOURCE_DIR/node_modules
enable:
- job1
- job3
pipeline:
- filename: ~/.npm
enable:
- job2
- filename: test.txt
disable:
- job3
job:
test: [/tmp/test-dir, /tmp/test.txt]
publish: [publish.txt]
This one is more flexible like:
This solution breaks present specification, so users have to migrate their cache settings.
Specifying true/false for each jobs.
cache:
event:
- $SD_SOURCE_DIR/node_modules
jobs:
main:
cache: false
image: node:12
steps:
- ls $SD_SOURCE_DIR/
What do you prefer to? Or any ideas? I think solution1 is sufficient.
I think it would be easier if I could control it in the job definition part.
cache:
event:
- $SD_SOURCE_DIR/node_modules
jobs:
main:
cache: false
image: node:12
steps:
- ls $SD_SOURCE_DIR/
Even if users can control each cache level indication finely, I think that the impact on speed will be small. This is to speed up the build, so I don't think users need detailed control.
Why solution2 and solution3 can specify diable and enable?
I think solution2 and solution3 able to specify only disable or enable is good idea.
I think the solution by @wahapo looks better than the others.
It is simple to write rules and users can understand it easily.
I prefer to @wahapo 's suggestion of adding disable flag to job's setting. It looks a bit cumbersome to set it up in the cache part.
@wahapo Added as solution4
@yuichi10 Added as solution2.1
How many people do you think cache on a per-file basis?
If a lot of people are going to use it, I think it needs to be cached on a per-file basis.
If there are a few use cases that user needs to write a detail cache setting, solution4 looks good.
I also recommend @wahapo 's idea.
If you really want to control the cache in detail at all levels of job, event, and pipeline, I think it would be cleaner to make a YAML just for controlling the cache.
How many people do you think cache on a per-file basis?
If a lot of people are going to use it, I think it needs to be cached on a per-file basis.
I do not receive requests about per-file cache for now.
We proceed to implement with solution4. @jithine @VMTeam Do you any concerns about this decision?
We proceed to implement with solution4. @jithine @VMTeam Do you any concerns about this decision?
I too like 4)
We are good with approach 4. 馃憤