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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,456,374
Community Members
 
Community Events
176
Community Groups

How to run jar files from another bitbucket repo in main bitbucket pipelines?

Hello,

I am working from my company's bitbucket account so I am trying to download the repo on which the required jar files are stored (I want to do this via ssh keys). I am working on creating the yaml file for bitbucket pipelines (for the main project repo) and I could not find a way to incorporate these jar files into my main repo as well as install dependencies - java 1.8 and sbt 1.6.2. I've seen a way to download the repo using a shell script and use maven... but is that necessary as there is no maven needed for this project? Please let me know which approach is best supported by Bitbucket to download jar files from external repos into bitbucket pipelines.

1 answer

0 votes
Ben Atlassian Team Jul 20, 2022

Hey Hareem,

Welcome to the Bitbucket Cloud Community! :)

I believe the easiest and best way to execute files from another repository using SSH is to clone the external repository in pipelines and then execute the files once it has been cloned. 

To do this, you will need to follow these steps to give the main repository read access to the target repository:

  1. You will need to generate an SSH key from the main repository (The repository executing pipelines)
  2. Under Settings > Pipelines > SSH keys
  3. Once you have generated the key, copy it
  4. Click 'Copy public key'
  5. Add the key to the repository you're looking to clone
  6. In the target repository: Settings > General > Access keys paste the key here
  7. Add a clone command to the bitbucket-pipelines.yml on the main repository
    script:
       - git clone git@bitbucket.org:workspaceID/reposlug.git
  8. Once the repo has been cloned in pipelines, you can cd to the directory and then run files from here:
    - cd ./reposlug
    - java -jar script.jar

There is an article here that explains this in-depth with screenshots:
https://bitbucket.org/blog/cloning-another-bitbucket-repository-in-bitbucket-pipelines 

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events