diff --git a/endpoints/api.py b/endpoints/api.py index 0a4700a22..c77fffbac 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -1239,7 +1239,10 @@ def request_repo_build(namespace, repository): permission = ModifyRepositoryPermission(namespace, repository) if permission.can(): logger.debug('User requested repository initialization.') - dockerfile_id = request.get_json()['file_id'] + request_json = request.get_json() + + dockerfile_id = request_json['file_id'] + subdir = request_json['subdirectory'] if 'subdirectory' in request_json else '' # Check if the dockerfile resource has already been used. If so, then it # can only be reused if the user has access to the repository for which it @@ -1255,7 +1258,7 @@ def request_repo_build(namespace, repository): display_name = user_files.get_file_checksum(dockerfile_id) build_request = start_build(repo, dockerfile_id, ['latest'], display_name, - '', True) + subdir, True) resp = jsonify(build_status_view(build_request, True)) repo_string = '%s/%s' % (namespace, repository) diff --git a/static/css/quay.css b/static/css/quay.css index 3ddf44b50..636343e4b 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -9,7 +9,23 @@ } } +.dockerfile-path { + margin-top: 10px; + padding: 20px; + padding-bottom: 0px; + font-family: Consolas, "Lucida Console", Monaco, monospace; + font-size: 14px; +} + +.dockerfile-path:before { + content: "\f15b"; + font-family: FontAwesome; + margin-right: 8px; + font-size: 18px; +} + .dockerfile-view { + margin-top: 10px; margin: 20px; padding: 20px; background: #F7F6F6; diff --git a/static/directives/trigger-description.html b/static/directives/trigger-description.html index 7cb1a5731..2a081aa69 100644 --- a/static/directives/trigger-description.html +++ b/static/directives/trigger-description.html @@ -9,7 +9,7 @@ -
+
Dockerfile: //Dockerfile diff --git a/static/js/app.js b/static/js/app.js index affa12fdb..d82bb27a1 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2672,7 +2672,8 @@ quayApp.directive('triggerDescription', function () { transclude: false, restrict: 'C', scope: { - 'trigger': '=trigger' + 'trigger': '=trigger', + 'short': '=short' }, controller: function($scope, $element) { } diff --git a/static/js/controllers.js b/static/js/controllers.js index a6b7bb8bd..5c3e25f6a 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -816,9 +816,23 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc // itself (should) be the Dockerfile. if (zipFiles && Object.keys(zipFiles).length) { // Load the dockerfile contents. - var dockerfile = zip.file('Dockerfile'); + var dockerfilePath = 'Dockerfile'; + if ($scope.repobuild['job_config']) { + var dockerfileFolder = ($scope.repobuild['job_config']['build_subdir'] || ''); + if (dockerfileFolder[0] == '/') { + dockerfileFolder = dockerfileFolder.substr(1); + } + if (dockerfileFolder[dockerfileFolder.length - 1] == '/') { + dockerfileFolder = dockerfileFolder.substr(0, dockerfileFolder.length - 1); + } + + dockerfilePath = dockerfileFolder + 'Dockerfile'; + } + + var dockerfile = zip.file(dockerfilePath); if (dockerfile) { $scope.dockerFileContents = dockerfile.asText(); + $scope.dockerFilePath = dockerfilePath; } // Build the zip file tree. @@ -833,6 +847,7 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc }); } else { $scope.dockerFileContents = response; + $scope.dockerFilePath = 'Dockerfile'; } $scope.loaded = true; @@ -951,8 +966,14 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope $scope.restartBuild = function(build) { $('#confirmRestartBuildModal').modal('hide'); + var subdirectory = ''; + if (build['job_config']) { + subdirectory = build['job_config']['build_subdir'] || ''; + } + var data = { - 'file_id': build['resource_key'] + 'file_id': build['resource_key'], + 'subdirectory': subdirectory }; var params = { diff --git a/static/js/graphing.js b/static/js/graphing.js index b796fd8a4..b4db1a78f 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -851,7 +851,8 @@ function FileTreeBase() { * Calculates the dimensions of the tree. */ FileTreeBase.prototype.calculateDimensions_ = function(container) { - var cw = document.getElementById(container).clientWidth; + var containerElm = document.getElementById(container); + var cw = containerElm ? containerElm.clientWidth : 1200; var barHeight = 20; var ch = (this.getNodesHeight() * barHeight) + 40; diff --git a/static/partials/build-package.html b/static/partials/build-package.html index 182fd9c58..5ca4dfd13 100644 --- a/static/partials/build-package.html +++ b/static/partials/build-package.html @@ -37,6 +37,7 @@
+
{{ dockerFilePath }}
No Dockerfile found in the build pack
diff --git a/static/partials/repo-build.html b/static/partials/repo-build.html index a4e4b253f..4ff47b487 100644 --- a/static/partials/repo-build.html +++ b/static/partials/repo-build.html @@ -40,7 +40,7 @@
- Triggered by: + Triggered by: