Skip to content

Commit

Permalink
Merge branch 'master' into support-glob-recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloudy committed Aug 8, 2019
2 parents 2289275 + baf8b9a commit b381c87
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 40 deletions.
@@ -0,0 +1 @@
:issue:`4928`: Update buildbot worker image to ubuntu 18.04
@@ -0,0 +1 @@
:issue:`4873`: Fix Bitbucket Cloud hook crash due to changes in their API.
48 changes: 24 additions & 24 deletions master/buildbot/test/unit/test_www_hooks_bitbucketcloud.py
Expand Up @@ -31,7 +31,7 @@
pushJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"repository": {
Expand All @@ -52,7 +52,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -87,7 +87,7 @@
pullRequestCreatedJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"pullrequest": {
Expand All @@ -111,7 +111,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -143,7 +143,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -175,7 +175,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand All @@ -186,7 +186,7 @@
pullRequestUpdatedJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"pullrequest": {
Expand All @@ -210,7 +210,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -242,7 +242,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -274,7 +274,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand All @@ -285,7 +285,7 @@
pullRequestRejectedJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"pullrequest": {
Expand All @@ -309,7 +309,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -341,7 +341,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -373,7 +373,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand All @@ -384,7 +384,7 @@
pullRequestFulfilledJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"pullrequest": {
Expand All @@ -408,7 +408,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -440,7 +440,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -472,7 +472,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand All @@ -483,7 +483,7 @@
deleteTagJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"repository": {
Expand All @@ -504,7 +504,7 @@
"ownerName": "BUIL",
"public": false,
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -532,7 +532,7 @@
deleteBranchJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"repository": {
Expand All @@ -553,7 +553,7 @@
"ownerName": "CI",
"public": false,
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down Expand Up @@ -581,7 +581,7 @@
newTagJsonPayload = """
{
"actor": {
"username": "John",
"nickname": "John",
"display_name": "John Smith"
},
"repository": {
Expand All @@ -602,7 +602,7 @@
"public": false,
"ownerName": "CI",
"owner": {
"username": "CI",
"nickname": "CI",
"display_name": "CI"
},
"fullName": "CI/py-repo"
Expand Down
9 changes: 5 additions & 4 deletions master/buildbot/www/hooks/bitbucketcloud.py
Expand Up @@ -70,7 +70,7 @@ def _get_payload(self, request):

def handle_repo_push(self, payload):
changes = []
project = payload['repository']['project']['name']
project = payload['repository'].get('project', {'name': 'none'})['name']
repo_url = payload['repository']['links']['self']['href']
web_url = payload['repository']['links']['html']['href']

Expand All @@ -94,7 +94,7 @@ def handle_repo_push(self, payload):
'revlink': '{}/commits/{}'.format(web_url, commit_hash),
'repository': repo_url,
'author': '{} <{}>'.format(payload['actor']['display_name'],
payload['actor']['username']),
payload['actor']['nickname']),
'comments': 'Bitbucket Cloud commit {}'.format(commit_hash),
'branch': branch,
'project': project,
Expand Down Expand Up @@ -139,15 +139,16 @@ def handle_pullrequest_rejected(self, payload):
def handle_pullrequest(self, payload, refname, category):
pr_number = int(payload['pullrequest']['id'])
repo_url = payload['repository']['links']['self']['href']
project = payload['repository'].get('project', {'name': 'none'})['name']
change = {
'revision': payload['pullrequest']['fromRef']['commit']['hash'],
'revlink': payload['pullrequest']['link'],
'repository': repo_url,
'author': '{} <{}>'.format(payload['actor']['display_name'],
payload['actor']['username']),
payload['actor']['nickname']),
'comments': 'Bitbucket Cloud Pull Request #{}'.format(pr_number),
'branch': refname,
'project': payload['repository']['project']['name'],
'project': project,
'category': category,
'properties': {'pullrequesturl': payload['pullrequest']['link']}
}
Expand Down
11 changes: 5 additions & 6 deletions worker/Dockerfile
Expand Up @@ -6,7 +6,7 @@
# Provides a base Ubuntu (16.04) image with latest buildbot worker installed
# the worker image is not optimized for size, but rather uses ubuntu for wider package availability

FROM ubuntu:16.04
FROM ubuntu:18.04
MAINTAINER Buildbot maintainers


Expand All @@ -28,14 +28,13 @@ RUN apt-get update && \
libffi-dev \
libssl-dev \
python-setuptools \
curl && \
rm -rf /var/lib/apt/lists/* && \
python-pip \
# Test runs produce a great quantity of dead grandchild processes. In a
# non-docker environment, these are automatically reaped by init (process 1),
# so we need to simulate that here. See https://github.com/Yelp/dumb-init
curl https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64.deb -Lo /tmp/init.deb && dpkg -i /tmp/init.deb &&\
# ubuntu pip version has issues so we should use the official upstream version it: https://github.com/pypa/pip/pull/3287
easy_install pip && \
dumb-init \
curl && \
rm -rf /var/lib/apt/lists/* && \
# Install required python packages, and twisted
pip --no-cache-dir install 'twisted[tls]' && \
pip install virtualenv && \
Expand Down
2 changes: 2 additions & 0 deletions www/base/src/app/app.module.js
Expand Up @@ -50,6 +50,8 @@ require('./builders/step/step.controller.js');
require('./builders/step/step.route.js');
require('./buildrequests/pendingbuildrequests.controller.js');
require('./buildrequests/pendingbuildrequests.route.js');
require('./changes/changebuilds/changebuilds.controller.js');
require('./changes/changebuilds/changebuilds.route.js');
require('./changes/changes.controller.js');
require('./changes/changes.route.js');
require('./common/common.constant.js');
Expand Down
40 changes: 40 additions & 0 deletions www/base/src/app/changes/changebuilds/changebuilds.controller.js
@@ -0,0 +1,40 @@
class ChangeBuildsController {
constructor($scope, dataService, bbSettingsService, $stateParams, resultsService, $interval, restService) {

_.mixin($scope, resultsService);
$scope.settings = bbSettingsService.getSettingsGroup('ChangeBuilds');
$scope.$watch('settings', () => bbSettingsService.save()
, true);
const buildsFetchLimit = $scope.settings.buildsFetchLimit.value;

const dataAccessor = dataService.open().closeOnDestroy($scope);
$scope.builders = dataAccessor.getBuilders();

const changeId = $scope.changeId = $stateParams.changeid;

dataAccessor.getChanges(changeId).onNew = function(change) {
$scope.change = change;
}

const getBuildsData = function() {
let requestUrl = `changes/${changeId}/builds`;
if (!buildsFetchLimit == '') {
requestUrl = `changes/${changeId}/builds?limit=${buildsFetchLimit}`;
}
restService.get(requestUrl).then((data) => {
$scope.builds = data.builds;
});
}

getBuildsData();

const stop = $interval(() => {
getBuildsData();
}, 5000);

$scope.$on('$destroy', () => $interval.cancel(stop));
}
}

angular.module('app')
.controller('changebuildsController', ['$scope', 'dataService', 'bbSettingsService', '$stateParams', 'resultsService', '$interval', 'restService', ChangeBuildsController]);
35 changes: 35 additions & 0 deletions www/base/src/app/changes/changebuilds/changebuilds.route.js
@@ -0,0 +1,35 @@
class ChangeBuildsState {
constructor($stateProvider, bbSettingsServiceProvider) {
// Name of the state
const name = 'changebuilds';

// Configuration
const cfg = {}

// Register new state
const state = {
controller: `${name}Controller`,
template: require('./changebuilds.tpl.jade'),
name,
url: '/changes/:changeid',
data: cfg,
reloadOnSearch: false
}

$stateProvider.state(state);

bbSettingsServiceProvider.addSettingsGroup({
name:'ChangeBuilds',
caption: 'ChangeBuilds page related settings',
items:[{
type:'integer',
name:'buildsFetchLimit',
caption:'Maximum number of builds to fetch for the selected change',
default_value: ''
}]
});
}
}

angular.module('app')
.config(['$stateProvider', 'bbSettingsServiceProvider', ChangeBuildsState]);
5 changes: 5 additions & 0 deletions www/base/src/app/changes/changebuilds/changebuilds.tpl.jade
@@ -0,0 +1,5 @@
.container
.row
changedetails(change="change")
div(ng-if="builds")
builds-table(builds="builds", builders="builders", ng-if="builds")
5 changes: 3 additions & 2 deletions www/base/src/app/changes/changes.controller.js
@@ -1,5 +1,6 @@
class Changes {
constructor($log, $scope, dataService, bbSettingsService) {
constructor($log, $scope, dataService, bbSettingsService,
$location, $rootScope) {
$scope.settings = bbSettingsService.getSettingsGroup("Changes");
$scope.$watch('settings', () => bbSettingsService.save()
, true);
Expand All @@ -13,4 +14,4 @@ class Changes {


angular.module('app')
.controller('changesController', ['$log', '$scope', 'dataService', 'bbSettingsService', Changes]);
.controller('changesController', ['$log', '$scope', 'dataService', 'bbSettingsService', '$location', '$rootScope', Changes]);

0 comments on commit b381c87

Please sign in to comment.