Read all the repos in bitbucket - bitbucket

I want to make a script in Python, that is able to read all repositories from a Bitbucket account, to find some content inside code files.
Is it possible to make this?
Thanks

Related

Jenkins Github organization scan a team

We have a Github organization, which is broken into teams.
I want to use Jenkins github plugin to just scan my teams folder, is this possible?
So far I can only get it to scan the whole org which has thousands of repos in it, or scan my user which also picks up other repos outside the team.
I have tried scanning for <ORG>/teams/<TEAM> but Jenkins seems to think that is a user and looks in the user api rather than org.
I know I could use a repo name filter, but currently the repos dont have a standard enough name to do that on and renaming them would be a pain as all links and clone would need updating.
Any help most appreciated.

Using Gerrit to restrict read access to a git branch

I'm beginning to suspect that this is not possible. I was hoping that I could set up custom access control in Gerrit so that a particular role (defined in TF) would not have read access to a specific branch in a repo.
However, it appears that users with this role are unable to clone the repo at all. I was hoping they'd be able to clone and just not beb able to check out the restricted branch.
Just wondering if anyone else has enountered this and might be able to confirm the behaviour I'm seeing. I did see another thread here recommending gitolite for partial copies but I'm restricted to using TF/Gerrit.
Thanks!

Is it possible to create or edit a Jenkins Project on the fly?

My question was too long so I've shortened it:
Is it possible to create or edit a Jenkins Project on the fly with a template/environment variables/coding/etc, and would this be possible via a trigger from Gitlab/hub/etc.? If someone could point me in the right direction that would be great! Thanks!
Yes.
Your options are to use the rest API (and there's more detailed information in your own Jenkins, check the link in the bottom right corner of every page), or to create the job directory structure and XML files manually and have Jenkins re-scan its workspace directories.
I strongly recommend the rest API. It's designed for this sort of thing.

How to assign access rights to a Gerrit project using API / SSH?

I'm looking for a way to automatically add +2 permissions for certain refs for a lot of projects in Gerrit and unfortunately it seems there are no API calls to modify access rights, only to read them. Do you have any idea how to modify refs permissions for a big amount of projects?
I'm using Gerrit 2.9.
Thanks.
One possibility would be to create a batch script to modify the project.config for those projects and commit them back to gerrit.
This is how you can checkout the project.config for the All-Projects, it works the same for other projects: http://blog.bruin.sg/2013/04/how-to-edit-the-project-config-for-all-projects-in-gerrit/
Simply put:
Create list of project you want to change
Iterate over the lest
Checkout the refs/meta/config ref
Use script to modify project.config
Commit and push back to the server
More information about the project.config: http://gerrit-review.googlesource.com/Documentation/config-project-config.html

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