Hi,
I'm using for the first time the pipeline feature in bitbucket.org, and I'm surprised to see that for each build triggered by new commits, maven always download dependencies, even if they were previously downloaded in another build.
Is it a bug or not ?
Regards,
For all the people dropping by currently, please note that Atlassian now supports caching dependencies via the "cache" directive in the piplelines yml file. Refer to https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html.
This is an expected result of Bitbucket Pipelines build environments being comprised of ephemeral Docker containers that run automatically after each code push. That is, for each build a new Docker container is launched, and then terminated at the end of the build, which implies that all non explicitly managed files (like the cached Maven artifacts at hand) only live as long as the container itself.
This 'build from scratch' behavior is usually highly desired to guarantee that builds are completely isolated from each other. The obvious downside is that any form of build time and resource usage optimizations like caching dependencies does not work out of the box.
To facilitate those optimizations regardless, you can create custom Docker images and use these tailored build environments instead of the default ones. So for the scenario at hand you might want to create a container image that has those Maven dependencies downloaded already - of course, such tailored images should ideally be maintained via CI/CD as well, and while Bitbucket Pipelines itself cannot yet build Docker images, Bitbucket still offers an indirect approach for this via Docker Hub as outlined in Configure automated builds with Bitbucket (beware that this has nothing to do with Pipelines at all).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.