Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Andreas Schröck May 31, 2022

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

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2022

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

Andreas Schröck June 2, 2022

Thx for the links!

The docker image must be on docker hub, correct?

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 3, 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

Andreas Schröck June 7, 2022

Thx!

Is there any documentation available on how to use Azure?

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 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
AUG Leaders

Atlassian Community Events