From 9703850e8fb24c86ccf40ee670f52337e748714d Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 22 Apr 2015 13:22:04 -0400 Subject: [PATCH] enforce short SHAs throughout build pipeline --- endpoints/trigger.py | 2 +- .../create-external-notification-dialog.html | 1 + static/directives/manual-trigger-build-dialog.html | 11 ++++++++++- .../js/directives/ui/manual-trigger-build-dialog.js | 6 +++++- static/js/services/trigger-service.js | 6 ++++-- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/endpoints/trigger.py b/endpoints/trigger.py index 8f8ef1809..2f79a4a72 100644 --- a/endpoints/trigger.py +++ b/endpoints/trigger.py @@ -565,7 +565,7 @@ class CustomBuildTrigger(BuildTrigger): 'commit': { 'type': 'string', 'description': 'first 7 characters of the SHA-1 identifier for a git commit', - 'pattern': '^(\w{7})$', + 'pattern': '^([A-Fa-f0-9]{7})$', }, 'ref': { 'type': 'string', diff --git a/static/directives/create-external-notification-dialog.html b/static/directives/create-external-notification-dialog.html index dda01936f..0b7401c30 100644 --- a/static/directives/create-external-notification-dialog.html +++ b/static/directives/create-external-notification-dialog.html @@ -81,6 +81,7 @@ +
+ +
+ +
diff --git a/static/js/directives/ui/manual-trigger-build-dialog.js b/static/js/directives/ui/manual-trigger-build-dialog.js index 617588e46..28d3bd93e 100644 --- a/static/js/directives/ui/manual-trigger-build-dialog.js +++ b/static/js/directives/ui/manual-trigger-build-dialog.js @@ -25,6 +25,10 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () { }); }; + $scope.getPattern = function(field) { + return new RegExp(field.regex); + }; + $scope.show = function() { $scope.parameters = {}; $scope.fieldOptions = {}; @@ -58,4 +62,4 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () { } }; return directiveDefinitionObject; -}); \ No newline at end of file +}); diff --git a/static/js/services/trigger-service.js b/static/js/services/trigger-service.js index e2bb9c64c..665bd5b57 100644 --- a/static/js/services/trigger-service.js +++ b/static/js/services/trigger-service.js @@ -62,8 +62,10 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K 'run_parameters': [ { 'title': 'Commit', - 'type': 'string', - 'name': 'commit_sha' + 'type': 'regex', + 'name': 'commit_sha', + 'regex': '^([A-Fa-f0-9]{7})$', + 'placeholder': '1c002dd' } ], 'get_redirect_url': function(namespace, repository) {