Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a build monitor for BitBucket pipelines?

Saleem Siddiqui July 23, 2019

I am looking for a build monitor for my team's BitBucket pipelines.

 

I have looked at https://github.com/marcells/node-build-monitor, but haven't had success in configuring it. The instructions in its README are a bit out of date: they mention API-Keys which are now deprecated in BitBucket.

 

Quesitons:

1. What is the community using as a build monitor for BitBucket pipelines? (Ideally, something with a simple, bold UI like nevergreen.io.)

2. Are there instructions on how to configure such a build monitor?

Thank you.

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2019

Hello @Saleem Siddiqui,

I'm not aware of build monitors for Bitbucket Pipelines, I just wanted to admit that the one you mentioned, node-build-monitor, simply messes up "App password" with "API key" in their documentation.

In fact, what they call apiKey seems to be used to build basic auth header value, so what you need is to create an App password (app passwords are not deprecated in Bitbucket) with Pipelines:Read scope, and use the generated password in the monitor configuration.

Hope this helps.

Cheers,
Daniil

Saleem Siddiqui July 23, 2019

Thanks. @Daniil Penkin , for your answer.

I have tried the approach you suggested: (1) putting an app password in the field named "apiKey" and (2) turning on Pipelines:Read scope. It didn't work for me.

I think the most significant configuration in the node-build-monitor's config.json I'm missing is "slug". The documentation simply says "The name of the project"; however, I would think it has to be more like "fully qualified URL to the project in BitBucket". Otherwise, how would node-build-monitor ever find the project.

I'm posting the entire config.json below.

 

{
"monitor": {
"interval": 30000,
"numberOfBuilds": 1,
"latestBuildOnly": false,
"sortOrder": "date",
"errorsFirst": false,
"expandEnvironmentVariables": false,
"debug": true
},
"services": [
{
"name": "Bitbucket",
"configuration": {
"apiKey": "MY_APP_PWD_WHICH_I_HAVE_OBFUSCATED_HERE",
"username": "my-username",
"slug": "https://bitbucket.org/fully/qualified/path/to/my/bitbucket/repo"
}
}
]
}
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2019

node-build-monitor constructs a URL to fetch pipelines status based on the configuration parameters. A slug there means repository slug, which is the second part in the path on Bitbucket. The fully qualified path to your bitbucket repo you mentioned consists of the account name (aka owner) and repository slug.

For example, for this Bitbucket repository:

https://bitbucket.org/atlassian/atlaskit-mk-2

the slug is atlaskit-mk-2

Let me know if that worked.

Cheers,
Daniil

Saleem Siddiqui July 24, 2019

Thanks, @Daniil Penkin , for the clarification.

I'm getting a 404 now. Here are the details.

Bitbucket repository URL: https://bitbucket.org/my-company/my-project-repo

When I navigate to this path in a browser, I'm automatically redirected to the master branch, which makes sense. https://bitbucket.org/my-company/my-project-repo/src/master/ (This may or may not be relevant.)

 

My current config.json (after your suggestion): 

{
"monitor": {
"interval": 30000,
"numberOfBuilds": 1,
"latestBuildOnly": false,
"sortOrder": "date",
"errorsFirst": false,
"expandEnvironmentVariables": false,
"debug": true
},
"services": [
{
"name": "BitbucketPipelines",
"configuration": {
"apiKey": "MY_APP_PWD_WHICH_I_HAVE_OBFUSCATED_HERE",
"username": "my-username",
"slug": "my-project-repo"
}
}
]
}

With all this, I get this error:

9:19:16 AM | 0 builds found....
9:19:46 AM | Check for builds...
**********************************************************************
An error occured when fetching builds for the following configuration:
----------------------------------------------------------------------
{ apiKey: 'MY_APP_PWD_WHICH_I_HAVE_OBFUSCATED_HERE',
username: 'my-username',
slug: 'my-project-repo' }
----------------------------------------------------------------------

Error: HTTP Reponse: 404 Not Found
at Request._callback (/snapshot/node-build-monitor/app/requests.js:42:28)
at Request.init.self.callback (/snapshot/node-build-monitor/node_modules/request/request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/snapshot/node-build-monitor/node_modules/request/request.js:1161:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/snapshot/node-build-monitor/node_modules/request/request.js:1083:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
**********************************************************************

Saleem Siddiqui July 24, 2019

Addendum to previous post.

 

I think I understand the superficial reason for the 404: the way node-build-monitor constructs a URL means it'll use "my-username", and the URL will be: https://bitbucket.org/my-username/my-project-repo ... which would (obviously) yield a 404.

However, when I try putting my-company in the config.json, like this:

"username": "my-company",

 to ensure that the URL is correctly generated, then I get a 401 Unauthorized response.

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2019

This is because username property is also used in basic auth – if you change it to your company name, your app password makes no sense cause it only works with your username.

However, looking again at how the repository URL is constructedteamname has higher priority, so if it is present in the configuration, it'll be used as repository location. Hence your configuration should look like this:

{
"apiKey": "my-app-password",
"teamname": "my-company",
"username": "my-username",
"slug": "my-project-repo"
}

Hope this works.

Cheers,
Daniil

Saleem Siddiqui July 24, 2019

That worked! Your help has been delightfully useful,@Daniil Penkin .

I've accepted your answer. Thanks, again.

Like Daniil Penkin likes this
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2019

 No worries :) Glad to hear that it worked.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events