enforce short SHAs throughout build pipeline

This commit is contained in:
Jimmy Zelinskie 2015-04-22 13:22:04 -04:00
parent 133ed7190e
commit 9703850e8f
5 changed files with 21 additions and 5 deletions

View file

@ -565,7 +565,7 @@ class CustomBuildTrigger(BuildTrigger):
'commit': { 'commit': {
'type': 'string', 'type': 'string',
'description': 'first 7 characters of the SHA-1 identifier for a git commit', 'description': 'first 7 characters of the SHA-1 identifier for a git commit',
'pattern': '^(\w{7})$', 'pattern': '^([A-Fa-f0-9]{7})$',
}, },
'ref': { 'ref': {
'type': 'string', 'type': 'string',

View file

@ -81,6 +81,7 @@
</span> </span>
<input type="url" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="url" required> <input type="url" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="url" required>
<input type="text" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="string" required> <input type="text" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="string" required>
<!-- TODO(jschorr): unify the ability to create an input box with all the usual features -->
<div ng-switch-when="regex"> <div ng-switch-when="regex">
<input type="text" class="form-control" ng-model="currentConfig[field.name]" <input type="text" class="form-control" ng-model="currentConfig[field.name]"
ng-pattern="getPattern(field)" ng-pattern="getPattern(field)"

View file

@ -18,11 +18,20 @@
<span ng-switch-when="option"> <span ng-switch-when="option">
<span class="quay-spinner" ng-show="!fieldOptions[field.name]"></span> <span class="quay-spinner" ng-show="!fieldOptions[field.name]"></span>
<select ng-model="parameters[field.name]" ng-show="fieldOptions[field.name]" <select ng-model="parameters[field.name]" ng-show="fieldOptions[field.name]"
ng-options="value for value in fieldOptions[field.name]" ng-options="value for value in fieldOptions[field.name]"
required> required>
</select> </select>
</span> </span>
<input type="text" class="form-control" ng-model="parameters[field.name]" ng-switch-when="string" required> <input type="text" class="form-control" ng-model="parameters[field.name]" ng-switch-when="string" required>
<!-- TODO(jschorr): unify the ability to create an input box with all the usual features -->
<div ng-switch-when="regex">
<input type="text" class="form-control" ng-model="parameters[field.name]"
ng-pattern="getPattern(field)"
placeholder="{{ field.placeholder }}"
ng-name="field.name"
id="{{ field.name }}"
required>
</div>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -25,6 +25,10 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
}); });
}; };
$scope.getPattern = function(field) {
return new RegExp(field.regex);
};
$scope.show = function() { $scope.show = function() {
$scope.parameters = {}; $scope.parameters = {};
$scope.fieldOptions = {}; $scope.fieldOptions = {};
@ -58,4 +62,4 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
} }
}; };
return directiveDefinitionObject; return directiveDefinitionObject;
}); });

View file

@ -62,8 +62,10 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
'run_parameters': [ 'run_parameters': [
{ {
'title': 'Commit', 'title': 'Commit',
'type': 'string', 'type': 'regex',
'name': 'commit_sha' 'name': 'commit_sha',
'regex': '^([A-Fa-f0-9]{7})$',
'placeholder': '1c002dd'
} }
], ],
'get_redirect_url': function(namespace, repository) { 'get_redirect_url': function(namespace, repository) {