How do I get aws codebuild
to give me the same cache behavior for gradle
as when I run the build locally on my machine?
If I am executing cachable tasks on my own machine, this command:
gradle clean buildFunction buildLayer
Will take 2 seconds. However on the codebuild servers this same task takes almost 3 minutes, even when I have run the build before with the same commit/code, I was expecting the same behavior to have ultrafast builds. I tried adding all sorts of directories to the cache but to no avail.
My buildspec.yml
is as follows:
version: 0.1
phases:
install:
commands:
- echo Entering install phase...
- echo Nothing to do now
build:
commands:
- echo Build started on `date`
- gradle buildLayer buildFunction
cache:
paths:
- '.gradle/**/*'
- 'build/**/*'
- '/root/.gradle/caches/**/*'
- '/root/.gradle/wrapper/**/*'
- '/root/.m2/**/*'
artifacts:
type: zip
files:
- 'build/distributions/*.zip'