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,459,886
Community Members
 
Community Events
176
Community Groups

I would like to use runners to run the test cases on pullrequest.

Edited

I would like to use runners to run the test cases on pullrequest, earlier i was using  bitbuckets infrastructure to run the test cases whenever i do PR for the target branch.

 

The benifit for this approch was: A special pipeline that only runs on pull requests initiated from within your repository. It merges the destination branch into your working branch before it runs. Pull Request 

But  as my test cases are started increasing ,  and was getting Container "Build" failure even using 2x as size, so decided to use Runners feature to run my test cases on self hosted server.

 

My question is.
- Can I use Runners to execute test cases whenever PR is raised.

- How can i get the benifit of "It merges the destination branch into your working branch before it runs" 

Thanks

1 answer

1 accepted

1 vote
Answer accepted
Norbert C Atlassian Team Jan 28, 2022

Hi @Win Yourself ,

Thank you for contacting Atlassian Community, I'm Norbert from Bitbucket Cloud Support Team, it's nice to meet with you! 

I'd like to inform you what you would like to achieve is possible, you can do it the following way:

pipelines: 
pull-requests:
'**': #this runs as default for any branch not elsewhere defined

- step:
runs-on:
- self.hosted
script:
  - 
  - 

Answering your other question "How can i get the benifit of "It merges the destination branch into your working branch before it runs"

I'd like to inform you that this is fully automatic, once the Pipelines is initiated from a PR, it gets merged automatically.

Please let me know if you have any further question? We're here to help.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Actually I have started working on this litle experiment, really appreciate your response on my questions. 

 

The docker command which we get while setting up the runner, that does the real trick.

 

Once again thanks @Norbert C 

Norbert C Atlassian Team Jan 30, 2022

You're welcome @Win Yourself , I'm glad to hear I could help :) 

Hi @Norbert C ,

I was able to run the pipeline on my hosted machine, but following things I have noticed.

 

1. When the pipeline successfully get executed or when it gets failed. It removes the created container.

And because of this whatever resources I am downloading via script in pipeline, those are also getting removed

2. And when I run the same pipeline again, then whole process gets repeated, which leads to unnecessary time consumption.

 

Is there any way where we can persist downloaded data in a container, i don't want to download the data again and again. 

 

Thanks Man

Norbert C Atlassian Team Feb 01, 2022

Hi @Win Yourself 

I would like to inform you that actually this is working as expected.

Basically how Pipelines works is that when someone pushes a commit or creates a pull requests, Bitbucket Pipelines temporarily creates a container, where it's cloning the repository and runs the script from bitbucket-pipelines.yml file. When the build successfully executes or fails, the container is getting destroyed as there are no more things to do.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Like # people like this

Thanks for your response @Norbert C 

Got it, it's also mentioned in the official doc. Link

In this doc it's also mentioned that we can use the SCP / Rsync.

could you please tell me, how can i use this command in bitbucket-pipelines.yml file,

where i can download/access/copy the resource from other server to running container, so whatever scripts i am calling from bitbucket-pipelines.yml they can use these resources.

 

Thanks Man

Norbert C Atlassian Team Feb 07, 2022

Hi @Pritesh Tamhankar 

You're welcome.

What I would like to recommend you is:

* Setup the SSH-keys between your host and Pipelines by following the steps here: https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/

* Once you setup the SSH keys, you can copy the files from the host to the Pipelines build by doing this command:

rsync -e "ssh -o StrictHostKeyChecking=no" -a username@ip.of.the.host:/<path.in.the.host> <directory in the container build>

Please let me know how it goes, I'm here to help :)

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Like Win Yourself likes this

Hi @Norbert C ,

Apologies for the delay in the response.

I will work on this.

Thanks again.

Hi  @Norbert C 

i have followed the documentation to setup ssh keys.

However i think i have missed something not able to figure out, what it is

currently i am getting connection refused error.
e1.PNG

what i have done.. to test this.

- created new repo

- generated ssh keys

- updated the know host

- added the public key in authorized_keys (remote server)

-add on to this, also added the remote server ssh key to bitbucket acc ---> personal settings --> ssh key section.

- and yes my bitbucket pipeline.yml looks simple, through command arg i am trying to execute bash script available on remote server.e2.PNG

could you share your thoughts on this.

 

Thanks Man

Norbert C Atlassian Team Feb 20, 2022

Hi @Win Yourself 

It seems that Pipelines is not capable to connect to your remote server.

Can you whitelist all the Bitbucket related IPs on your firewall and let us know if that fixes the issue? What are the IP addresses to configure a corporate firewall?

Please let me know.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Like Win Yourself likes this

@Norbert CThanks for the response.

This step makes sense.

All good, thanks again.

Regards

Norbert C Atlassian Team Mar 03, 2022

You're welcome @Win Yourself  I'm glad to hear I was able to assist you.

Have a great weekend ahead!

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Like Win Yourself likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events