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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're welcome @Win Yourself , I'm glad to hear I could help :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
could you share your thoughts on this.
Thanks Man
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.