Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,588
Community Members
 
Community Events
165
Community Groups

How to use maven cache for pipelines with dependencies to other bitbucket repos?

I am currently trying to set up a project which is depending on another project on bitbucket.

I can compile everything with no issue, but I want to optimize the build procedure.

The project that I am depending on is quite large and does not change that often.

I am facing an issue right now: I am cloning the project at one step defined in the pipeline file. This is working but it rebuilds and installs the artifact every time to the local repository, which is not necessary because the same version is already existing.

How can I check if the cache already includes a certain artifact before cloning & installing the same thing over and over again?

1 answer

0 votes

Hello @Andreas Schröck ,

Thank you for reaching out to Atlassian Community.

From your description, I understand you are already using caches in your pipeline. What pipeline caches essentially do is zip a given folder and upload it to our infrastructure. On the subsequent runs, this zip will be downloaded and extracted in the same exact location it was generated, but it's up to the framework/tool you are using to make use of this cache.

We provide several pre-defined cache locations for commonly used language tools, as listed in the documentation below : 

But you can also define custom cache locations if your application is looking at different folders : 

As you mentioned you are cloning another huge dependency repository that does not change often, another option is for you to build your own custom docker image that already includes that dependency, and use that image in the steps that need the dependency. Since the image will already contain the repository, you will not need to clone it every time you do your build : 

Hope that helps! Let me know in case you have any questions.

Thank you, @Andreas Schröck .

Kind regards,

Patrik S

Thx for the links!

The docker image must be on docker hub, correct?

Patrik S Atlassian Team Jun 03, 2022

Hello @Andreas Schröck ,

We support public and private Docker images including those hosted on Docker Hub, AWS, GCP, Azure and self-hosted registries accessible on the internet, so it's up to your choice where you better prefer to host your image :) 

Kind regards,

Patrik S

Thx!

Is there any documentation available on how to use Azure?

Patrik S Atlassian Team Jun 07, 2022

Hello @Andreas Schröck ,

There's no specific documentation on how to use Azure, but the following example is for private registries and should apply to Azure Container Registry (ACR) as well : 

image: 
name: myregistry.azurecr.io/samples/my_image
username: $USERNAME
password: $PASSWORD

You can find more details on ACR in Microsoft's documentation below : 

Thank you, @Andreas Schröck .

Patrik S

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,158 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you