diff --git a/endpoints/api/trigger.py b/endpoints/api/trigger.py index 3dec076b6..95328818d 100644 --- a/endpoints/api/trigger.py +++ b/endpoints/api/trigger.py @@ -404,7 +404,7 @@ class ActivateBuildTrigger(RepositoryParamResource): 'description': '(Custom Only) If specified, the ref/SHA1 used to checkout a git repository.' }, 'refs': { - 'type': 'object', + 'type': ['object', 'null'], 'description': '(SCM Only) If specified, the ref to build.' } }, diff --git a/static/directives/manual-trigger-build-dialog.html b/static/directives/manual-trigger-build-dialog.html index 56f59ea14..8a8b8ee9e 100644 --- a/static/directives/manual-trigger-build-dialog.html +++ b/static/directives/manual-trigger-build-dialog.html @@ -26,7 +26,8 @@ icon-key="kind" icon-map="field.iconMap" items="fieldOptions[field.name]" - ng-show="fieldOptions[field.name]"> + ng-show="fieldOptions[field.name]" + clear-value="counter"> diff --git a/static/js/directives/ui/manual-trigger-build-dialog.js b/static/js/directives/ui/manual-trigger-build-dialog.js index a0f09cae2..80e1c631a 100644 --- a/static/js/directives/ui/manual-trigger-build-dialog.js +++ b/static/js/directives/ui/manual-trigger-build-dialog.js @@ -57,6 +57,8 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () { $scope.fieldOptions[parameter['name']] = resp['values']; }); } + + delete $scope.parameters[parameter['name']]; } $scope.runParameters = parameters; diff --git a/test/test_api_usage.py b/test/test_api_usage.py index eead6487f..0291fba4c 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -4059,11 +4059,18 @@ class TestBuildTriggers(ApiTestCase): self.assertEquals('bar', py_json.loads(build_obj.job_config)['trigger_metadata']['foo']) # Start another manual build, with a ref. - start_json = self.postJsonResponse(ActivateBuildTrigger, - params=dict(repository=ADMIN_ACCESS_USER + '/simple', - trigger_uuid=trigger.uuid), - data=dict(refs={'kind': 'branch', 'name': 'foobar'}), - expected_code=201) + self.postJsonResponse(ActivateBuildTrigger, + params=dict(repository=ADMIN_ACCESS_USER + '/simple', + trigger_uuid=trigger.uuid), + data=dict(refs={'kind': 'branch', 'name': 'foobar'}), + 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): self.login(ADMIN_ACCESS_USER)