Add a build display name, set it from the etag reported by s3 for file uploads.
This commit is contained in:
parent
e1a4efe35c
commit
85694dd110
8 changed files with 18 additions and 11 deletions
|
@ -216,7 +216,7 @@ class RepositoryBuild(BaseModel):
|
|||
tag = CharField()
|
||||
phase = CharField(default='waiting')
|
||||
started = DateTimeField(default=datetime.now)
|
||||
|
||||
display_name = CharField()
|
||||
|
||||
|
||||
class QueueItem(BaseModel):
|
||||
|
|
|
@ -1270,9 +1270,11 @@ def list_repository_builds(namespace_name, repository_name,
|
|||
return fetched
|
||||
|
||||
|
||||
def create_repository_build(repo, access_token, resource_key, tag):
|
||||
def create_repository_build(repo, access_token, resource_key, tag,
|
||||
display_name):
|
||||
return RepositoryBuild.create(repository=repo, access_token=access_token,
|
||||
resource_key=resource_key, tag=tag)
|
||||
resource_key=resource_key, tag=tag,
|
||||
display_name=display_name)
|
||||
|
||||
|
||||
def create_webhook(repo, params_obj):
|
||||
|
|
|
@ -59,3 +59,9 @@ class UserRequestFiles(object):
|
|||
full_key = os.path.join(self._prefix, file_id)
|
||||
k = Key(self._bucket, full_key)
|
||||
return k.generate_url(expires_in)
|
||||
|
||||
def get_file_checksum(self, file_id):
|
||||
self._initialize_s3()
|
||||
full_key = os.path.join(self._prefix, file_id)
|
||||
k = self._bucket.lookup(full_key)
|
||||
return k.etag[1:-1][:7]
|
||||
|
|
|
@ -1148,6 +1148,7 @@ def build_status_view(build_obj):
|
|||
'id': build_obj.uuid,
|
||||
'phase': build_obj.phase,
|
||||
'started': build_obj.started,
|
||||
'display_name': build_obj.display_name,
|
||||
'status': status,
|
||||
}
|
||||
|
||||
|
@ -1241,11 +1242,13 @@ def request_repo_build(namespace, repository):
|
|||
|
||||
repo = model.get_repository(namespace, repository)
|
||||
token = model.create_access_token(repo, 'write')
|
||||
display_name = user_files.get_file_checksum(dockerfile_id)
|
||||
logger.debug('**********Md5: %s' % display_name)
|
||||
|
||||
host = urlparse.urlparse(request.url).netloc
|
||||
tag = '%s/%s/%s' % (host, repo.namespace, repo.name)
|
||||
build_request = model.create_repository_build(repo, token, dockerfile_id,
|
||||
tag)
|
||||
tag, display_name)
|
||||
dockerfile_build_queue.put(json.dumps({
|
||||
'build_uuid': build_request.uuid,
|
||||
'namespace': namespace,
|
||||
|
|
|
@ -277,7 +277,8 @@ def populate_database():
|
|||
|
||||
token = model.create_access_token(building, 'write')
|
||||
tag = 'ci.devtable.com:5000/%s/%s' % (building.namespace, building.name)
|
||||
build = model.create_repository_build(building, token, '123-45-6789', tag)
|
||||
build = model.create_repository_build(building, token, '123-45-6789', tag,
|
||||
'build-name')
|
||||
build.uuid = 'deadbeef-dead-beef-dead-beefdeadbeef'
|
||||
build.save()
|
||||
|
||||
|
|
|
@ -668,11 +668,6 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
|
|||
$('.build-logs').height($(window).height() - 365);
|
||||
};
|
||||
|
||||
$scope.getShortId = function(id) {
|
||||
var lastIndex = id.lastIndexOf('-');
|
||||
return id.substr(lastIndex + 1);
|
||||
};
|
||||
|
||||
$scope.getCommandKind = function(fullTitle) {
|
||||
var colon = fullTitle.indexOf(':');
|
||||
var title = getTitleWithoutStep(fullTitle);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<li ng-class="currentBuild == build ? 'active' : ''" ng-repeat="build in builds">
|
||||
<a class="build-tab-link" href="javascript:void(0)" ng-click="setCurrentBuild(build.id, true)">
|
||||
<span class="phase-icon" ng-class="build.phase"></span>
|
||||
<span>{{ getShortId(build.id) }}</span>
|
||||
<span>{{ build.display_name }}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Binary file not shown.
Reference in a new issue