Merge pull request #2408 from coreos-inc/manual-trigger-bug-fix

Manual trigger bug fixes
This commit is contained in:
josephschorr 2017-03-07 20:53:21 -05:00 committed by GitHub
commit 873cda982e
4 changed files with 17 additions and 7 deletions

View file

@ -404,7 +404,7 @@ class ActivateBuildTrigger(RepositoryParamResource):
'description': '(Custom Only) If specified, the ref/SHA1 used to checkout a git repository.' 'description': '(Custom Only) If specified, the ref/SHA1 used to checkout a git repository.'
}, },
'refs': { 'refs': {
'type': 'object', 'type': ['object', 'null'],
'description': '(SCM Only) If specified, the ref to build.' 'description': '(SCM Only) If specified, the ref to build.'
} }
}, },

View file

@ -26,7 +26,8 @@
icon-key="kind" icon-key="kind"
icon-map="field.iconMap" icon-map="field.iconMap"
items="fieldOptions[field.name]" items="fieldOptions[field.name]"
ng-show="fieldOptions[field.name]"></div> ng-show="fieldOptions[field.name]"
clear-value="counter"></div>
</div> </div>
<!-- Option --> <!-- Option -->

View file

@ -57,6 +57,8 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
$scope.fieldOptions[parameter['name']] = resp['values']; $scope.fieldOptions[parameter['name']] = resp['values'];
}); });
} }
delete $scope.parameters[parameter['name']];
} }
$scope.runParameters = parameters; $scope.runParameters = parameters;

View file

@ -4059,12 +4059,19 @@ class TestBuildTriggers(ApiTestCase):
self.assertEquals('bar', py_json.loads(build_obj.job_config)['trigger_metadata']['foo']) self.assertEquals('bar', py_json.loads(build_obj.job_config)['trigger_metadata']['foo'])
# Start another manual build, with a ref. # Start another manual build, with a ref.
start_json = self.postJsonResponse(ActivateBuildTrigger, self.postJsonResponse(ActivateBuildTrigger,
params=dict(repository=ADMIN_ACCESS_USER + '/simple', params=dict(repository=ADMIN_ACCESS_USER + '/simple',
trigger_uuid=trigger.uuid), trigger_uuid=trigger.uuid),
data=dict(refs={'kind': 'branch', 'name': 'foobar'}), data=dict(refs={'kind': 'branch', 'name': 'foobar'}),
expected_code=201) expected_code=201)
# Start another manual build with a null ref.
self.postJsonResponse(ActivateBuildTrigger,
params=dict(repository=ADMIN_ACCESS_USER + '/simple',
trigger_uuid=trigger.uuid),
data=dict(refs=None),
expected_code=201)
def test_invalid_robot_account(self): def test_invalid_robot_account(self):
self.login(ADMIN_ACCESS_USER) self.login(ADMIN_ACCESS_USER)