Bitbucket scriptrunner API endpoints to automate? - bitbucket

I'm looking for Bitbucket scriptrunner API endpoints to automate enabling the merge checks available via this plugin in Bitbcuket.
Is there any documentation or steps?
Otherwise, I use the API's for other automations in Bitbucket here:
https://docs.atlassian.com/bitbucket-server/rest/7.2.3/bitbucket-git-rest.html
I tried with this but doesn't seem to work:
requests.get('https://stash.com/rest/api/1.0/projects/project-x/repos/test/scriptrunner')
Thanks

Take a look at Script REST Endpoints https://scriptrunner.adaptavist.com/4.3.4/bitbucket/rest-endpoints.html

Related

XRAY integration with jenkins

Need step to integrate XRAY with jenkins , as per the official documentation we need to give JIRA url ,select cloud or server/data center and select the credentials of JIRA account , then the configuration id will be get generated ... So we need to use that config id in pipeline
Is there any other way just to add username/password of jira in jenkins credentials and connect with XRAY from jenkins
If you are using the Xray Jenkins plugin you must provide the mandatory information to communicate with Xray as described here: https://docs.getxray.app/display/XRAYCLOUD/Integration+with+Jenkins.
You also have the possibility to use the Xray API and control the parameters you need to ask for, if you pre-configure some parameters on the code and only ask for login and password. To connect to Xray you will need some mandatory parameters that are described here: https://docs.getxray.app/display/XRAYCLOUD/Version+1, how many of those you can have pre-defined is up to your usage.
First, please check if you are using Xray on Jira cloud or Jira server/datacenter.
To submit results from Jenkins you have 3 options:
use the Xray Jenkins plugin UI itself, and configure a project to submit the test results; this is pretty straighforward
use the Xray Jenkins plugin but from the pipeline; for that you need to generate the pipeline script
use either the Jenkins UI or the pipeline to invoke the API by hand; for this you don't need the Xray Jenkins plugin, you just need some tool such as "curl" to perform the HTTP requests (see example for GitLab and Xray cloud here, and for Xray server/DC here)
Note that for Xray in Jira cloud, you need to use client_id and client_secret to perform an initial authentication request (in case you're doing the requests by hand). These are obtained from an API key defined on Xray global settings.
For Xray on Jira server/datacenter, you may use Jira credentials (e.g. Jira username + password). It only requires you to perform one request and submit the test results.

Create a Pull request in bitbucket using Jenkins job

I am interested in creating a pull request on bitbucket using jenkins pipeline job based on groovy. I am creating a jenkins job which is pulling the code then doing some changes and then pushing the code to bitbucket and then I want to raise PullRequest.
Any help would be really appreciated.
Thanks
I'm looking for the same, unfortunately I only find a way to do this using the bitbucket rest apis.
It would be nice to have a plugin to do this, but I could not find it.
This is the rest api
https://docs.atlassian.com/bitbucket-server/rest/7.6.0/bitbucket-rest.html#idp291
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests
There are more details here
How to create a pull request in a Bitbucket using api 1.0

In Jenkins what's the differences between Remote access API and Pipeline REST API

In Jenkins, we want to get the Pipeline stages information through API, e.g. a stage is success or fail. From another answer it seems we can achieve it through Pipeline REST API Plugin.
My question is:
Can Jenkinsapi and Python-Jenkins achieve the same thing? It seems they're designed for bare metal Jenkins, instead of the Pipeline plugin, right ? If that's the case, do we have similar Python library for Pipeline plugin?
Thanks!
You have all the info to answer your own question in the documentation you linked. Just to put it together:
Jenkins has a REST API
The pipeline REST API plugin injects new endpoints in the Jenkins REST API to give you access to several pipeline info
Python-Jenkins and jenkinsapi you mentioned above are both wrappers around the Jenkins REST API to help you develop scripts/apps targeting the Jenkins API in Python. Since those modules/libs are based most probably based on the core API specification, they most probably don't provide specific methods to target the pipeline endpoints (but you can probably extend that quite easily).
If you want to stay in Jenkinsapi, get_data() defined in JenkinsBase class could be used for querying Pipeline REST API directly. Not very sure if it's recommended or not.
Following codes works for me.
from jenkinsapi.jenkins import Jenkins
import requests
requests.packages.urllib3.disable_warnings()
# GET /job/:job-name/:run-id/wfapi/describe
url = 'https://localhost/job/anyjob/10/wfapi/describe'
jenkins = Jenkins(
'https://localhost',
username='username',
password='api_token',
ssl_verify=False,
lazy=True)
print(jenkins.get_data(url))

Taiga Bitbucket Integration

I was trying to integrate Bitbucket in the taiga. But I'm not able to figure it out how to do it. I went through support section also but no result.
I'm new to this so please can anyone help me how to integrate bitbucket in Taiga.
If there is any video or blog please share the link it will be really helpful.
Thanks
Have a look at this link from the Taiga documentation. It goes through the process of integrating information from your bitbucket repository using bitbucket webhooks.

Bitbucket: How to create a list of issues from multiple repositories?

We have several repositories on BitBucket. For every repository we
have the issue tracker enabled. For our progress reports I would like
to be able to see all issues from all related repositories in one
overview.
Is this possible and how can it be done?
Thanks,
Paul
Bitbucket has an API. You could quickly put together a script (or webpage using JSONP) calling:
https://api.bitbucket.org/1.0/repositories/USERNAME/REPOSITORY/issues/
for each repository? (Replacing USERNAME and REPOSITORY with appropriate values)
For something more advanced you could query the USER, get all their repositories, then iterate.
I needed the same thing today so I made the following python script available here on github.
The two API call URLs you need are
https://bitbucket.org/api/1.0/user/repositories/
https://bitbucket.org/api/1.0/repositories/{owner}/{slug}/issues/
You'll have to authenticate with your BitBucket credentials which I did using the python requests library:
response = requests.get(url, auth=HTTPBasicAuth(_USERNAME, _PASSWORD))

Resources