Bitbucket
Number of APIs: 9
Bitbucket code coverage
PPT and Demo: https://docs.google.com/presentation/d/1Fned6bpBIncRMdgIdMmA0gkoCUXRVpHw5jn78izQ1mM/edit?usp=sharing
Setup
- Clone the environment: [
Obtain and fill the required secrets:
a. bitbucketclientid
b. bitbucketsecret
c. apitemplateapikey
d. slackbot_tokenTo get
bitbucket_client_id
andbitbucket_secret
: On your Bitbucket account go toworkspace settings
->oauth consumers
->add consumers
To getapitemplate_api_key
, create an account onhttps://app.apitemplate.io/
and then go toAPI integration
Getslack_bot_token
fromayush.jain
on slack.Configure other environment variables:
a.project_id
: Project id from url on bitbucket for your project.
b.apitemplate_template_id
: Reach outayush.jain
on Slack
c.slack_channel_id
: Open slack on browser and browse the channel you want to post the updates on. Copy the last part of the url after slash (last path) Eg:C03JLAD8T7C
.
d.comparision_days
: Number of days to compare your current coverage from
e.tag_user
: Slack user name of the person you want tocc
to report thread on slack
Run
Can be run using either of the 2 ways:
- Create a weekly/monthly monitor to run this collection.
- Use Qodex runner to run the collection.
-
Pipelines - Get pipelines from previous GET https://api.bitbucket.org/2.0/repositories/:workspace/:repo_slug/pipelines/?page=1&pagelen=30&sort=-created_on&target.branch=develop
-
Pipelines - List pipeline steps from previous GET https://api.bitbucket.org/2.0/repositories/:workspace/:repo_slug/pipelines/:pipeline_uuid/steps/
-
Slack APIs - Add remote file POST https://slack.com/api/files.remote.add
-
Pipelines - Get step log new GET https://api.bitbucket.org/2.0/repositories/:workspace/:repo_slug/pipelines/:pipeline_uuid/steps/:step_uuid/log
-
Auth - Access token POST https://bitbucket.org/site/oauth2/access_token
-
Repos - Get project repos GET https://api.bitbucket.org/2.0/repositories/:workspace?q=project.key="{{project_id}}"
-
Apitemplate - Get coverage PDF POST https://rest.apitemplate.io/v2/create-pdf?template_id={{apitemplate_template_id}}
-
Slack APIs - Share remote file POST https://slack.com/api/files.remote.share
-
Slack APIs - Reply to thread POST https://slack.com/api/chat.postMessage