DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Software Delivery at Scale: Centralized Jenkins Pipeline for Optimal Efficiency
  • 5 Subtle Indicators Your Development Environment Is Under Siege
  • Concourse CI/CD Pipeline: Webhook Triggers
  • Automating Data Pipelines: Generating PySpark and SQL Jobs With LLMs in Cloudera

Trending

  • Software Delivery at Scale: Centralized Jenkins Pipeline for Optimal Efficiency
  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 2
  • How to Merge HTML Documents in Java
  1. DZone
  2. Data Engineering
  3. Databases
  4. Cloning Another Bitbucket Repository in Bitbucket Pipelines

Cloning Another Bitbucket Repository in Bitbucket Pipelines

In this article, take a look at cloning a bitbucket repository in bitbucket pipelines.

By 
Ayush Sharma user avatar
Ayush Sharma
·
Feb. 14, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
22.1K Views

Join the DZone community and get the full member experience.

Join For Free

I recently had a use case where I wanted to clone another Bitbucket repository during a Pipelines execution. Doing this is very simple, but there is a lot of conflicting information online, so I thought I would document the steps here.

Imagine a very simple Pipeline that looks like this:

YAML
x
 
1
pipelines:
2
  default:
3
    - step:
4
        script:
5
          - git clone git@bitbucket.org:ayushsharma/my-submodules.git


The repository that triggers the Pipeline will need permission to clone my-submodules.

Create SSH Keys for the Main Repository

In Bitbucket, go to the repository SSH keys page under Settings > Pipelines > SSH keys.

Cloning another Bitbucket repository in Bitbucket Pipelines - Settings > Pipelines > SSH keys


Next, click on Generate keys to let Bitbucket auto-generate a random, secure SSH key-pair. You can also upload a custom key-pair if you want.

You may also like: How I Use Bitbucket In My Regular Routine

Cloning another Bitbucket repository in Bitbucket Pipelines - Generate keys

 

Once completed, click Copy public key. We will need to paste this in the next step.

Add SSH Public Key in the Target Repository

Go to the my-submodules repository. Under Settings > General > Access keys, you should see the option to add SSH public keys to gain read-only access.

 

Cloning another Bitbucket repository in Bitbucket Pipelines - Settings > General > Access keys

 

Click Add key, enter a label, and paste the public key we copied in the previous step.

 

Cloning another Bitbucket repository in Bitbucket Pipelines - Add key

 

Our main repository now has read-only permissions to clone my-submodules from within its Pipelines. After the above configuration, executing a build for the repository will show all green.

 

Cloning another Bitbucket repository in Bitbucket Pipelines - Successful deployment!


Further Reading

Publishing API Console on Bitbucket Pages

Source Control Using Atlassian Bitbucket

Repository (version control) Pipeline (software) Cloning

Published at DZone with permission of Ayush Sharma, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Software Delivery at Scale: Centralized Jenkins Pipeline for Optimal Efficiency
  • 5 Subtle Indicators Your Development Environment Is Under Siege
  • Concourse CI/CD Pipeline: Webhook Triggers
  • Automating Data Pipelines: Generating PySpark and SQL Jobs With LLMs in Cloudera

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!