diff --git a/endpoints/api/build.py b/endpoints/api/build.py index 95e9f4607..75be9ffcc 100644 --- a/endpoints/api/build.py +++ b/endpoints/api/build.py @@ -112,13 +112,13 @@ def _get_build_status(build_obj): if datetime.datetime.utcnow() - heartbeat > datetime.timedelta(minutes=1): phase = database.BUILD_PHASE.INTERNAL_ERROR - # If the phase is internal error, return 'error' instead if the number of retries - # on the queue item is 0. - if phase == database.BUILD_PHASE.INTERNAL_ERROR: - retry = (build_obj.queue_id and - dockerfile_build_queue.has_retries_remaining(build_obj.queue_id)) - if not retry: - phase = database.BUILD_PHASE.ERROR + # If the phase is internal error, return 'expired' instead if the number of retries + # on the queue item is 0. + if phase == database.BUILD_PHASE.INTERNAL_ERROR: + retry = (build_obj.queue_id and + dockerfile_build_queue.has_retries_remaining(build_obj.queue_id)) + if not retry: + phase = 'expired' return (phase, status, error) diff --git a/static/css/directives/ui/build-state-icon.css b/static/css/directives/ui/build-state-icon.css index 31b4adb8a..125b0723e 100644 --- a/static/css/directives/ui/build-state-icon.css +++ b/static/css/directives/ui/build-state-icon.css @@ -7,11 +7,15 @@ } .build-state-icon .error { - color: red; + color: #D64456; +} + +.build-state-icon .expired { + color: #FCA657; } .build-state-icon .internalerror { - color: #DFFF00; + color: #99BA45; } .build-state-icon .complete { diff --git a/static/css/directives/ui/build-status.css b/static/css/directives/ui/build-status.css new file mode 100644 index 000000000..04bc04a92 --- /dev/null +++ b/static/css/directives/ui/build-status.css @@ -0,0 +1,38 @@ +.build-status { + display: inline-block; +} + +.build-status-container { + padding: 4px; + margin-bottom: 10px; + border-bottom: 1px solid #eee; + width: 350px; +} + +.build-status-container .build-message { + display: block; + white-space: nowrap; + font-size: 14px; + margin-bottom: 10px; + padding-bottom: 10px; + border-bottom: 1px solid #eee; + margin-left: 20px; +} + +.build-status-container .progress { + height: 10px; + margin: 0px; + margin-top: 10px; + margin-left: 20px; + width: 310px; +} + +.build-status-container .timing { + margin-left: 20px; + margin-top: 6px; +} + +.build-status-container:last-child { + margin-bottom: 0px; + border-bottom: 0px solid white; +} \ No newline at end of file diff --git a/static/css/directives/ui/phase-icon.css b/static/css/directives/ui/phase-icon.css new file mode 100644 index 000000000..2f095b60c --- /dev/null +++ b/static/css/directives/ui/phase-icon.css @@ -0,0 +1,48 @@ +.phase-icon { + border-radius: 50%; + display: inline-block; + width: 12px; + height: 12px; + margin-right: 6px; +} + +.active .build-tab-link .phase-icon { + box-shadow: 0px 0px 10px #FFFFFF, 0px 0px 10px #FFFFFF; +} + +.build-status .phase-icon { + margin-top: 4px; + float: left; +} + +.phase-icon.error { + background-color: #D64456; +} + +.phase-icon.expired { + background-color: #FCA657; +} + +.phase-icon.internalerror { + background-color: #99BA45; +} + +.phase-icon.waiting, .phase-icon.build-scheduled { + background-color: rgba(66, 139, 202, 0.2); +} + +.phase-icon.unpacking, .phase-icon.starting, .phase-icon.initializing { + background-color: rgba(66, 139, 202, 0.4); +} + +.phase-icon.pulling, .phase-icon.priming-cache, .phase-icon.checking-cache { + background-color: rgba(66, 139, 202, 0.6); +} + +.phase-icon.pushing, .phase-icon.building { + background-color: rgba(66, 139, 202, 0.8); +} + +.phase-icon.complete { + background-color: #2fcc66; +} diff --git a/static/css/quay.css b/static/css/quay.css index c5832945e..fa9fb3d91 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -565,90 +565,6 @@ i.toggle-icon:hover { border-bottom: 0px; } -.phase-icon { - border-radius: 50%; - display: inline-block; - width: 12px; - height: 12px; - margin-right: 6px; -} - -.active .build-tab-link .phase-icon { - box-shadow: 0px 0px 10px #FFFFFF, 0px 0px 10px #FFFFFF; -} - -.build-status .phase-icon { - margin-top: 4px; - float: left; -} - -.phase-icon.error { - background-color: red; -} - -.phase-icon.internalerror { - background-color: #DFFF00; -} - -.phase-icon.waiting, .phase-icon.build-scheduled { - background-color: rgba(66, 139, 202, 0.2); -} - -.phase-icon.unpacking, .phase-icon.starting, .phase-icon.initializing { - background-color: rgba(66, 139, 202, 0.4); -} - -.phase-icon.pulling, .phase-icon.priming-cache, .phase-icon.checking-cache { - background-color: rgba(66, 139, 202, 0.6); -} - -.phase-icon.pushing, .phase-icon.building { - background-color: rgba(66, 139, 202, 0.8); -} - -.phase-icon.complete { - background-color: #2fcc66; -} - -.build-status { - display: inline-block; -} - -.build-status-container { - padding: 4px; - margin-bottom: 10px; - border-bottom: 1px solid #eee; - width: 350px; -} - -.build-status-container .build-message { - display: block; - white-space: nowrap; - font-size: 14px; - margin-bottom: 10px; - padding-bottom: 10px; - border-bottom: 1px solid #eee; - margin-left: 20px; -} - -.build-status-container .progress { - height: 10px; - margin: 0px; - margin-top: 10px; - margin-left: 20px; - width: 310px; -} - -.build-status-container .timing { - margin-left: 20px; - margin-top: 6px; -} - -.build-status-container:last-child { - margin-bottom: 0px; - border-bottom: 0px solid white; -} - .repo-circle { position: relative; background: #eee; diff --git a/static/directives/build-logs-view.html b/static/directives/build-logs-view.html index 44a5d05ac..e5f0d2915 100644 --- a/static/directives/build-logs-view.html +++ b/static/directives/build-logs-view.html @@ -34,7 +34,7 @@ -
+
(Waiting for build to start) diff --git a/static/directives/build-state-icon.html b/static/directives/build-state-icon.html index 3d027ec69..f0408f339 100644 --- a/static/directives/build-state-icon.html +++ b/static/directives/build-state-icon.html @@ -3,6 +3,7 @@ + diff --git a/static/js/directives/ui/build-message.js b/static/js/directives/ui/build-message.js index bf097d690..10af170dc 100644 --- a/static/js/directives/ui/build-message.js +++ b/static/js/directives/ui/build-message.js @@ -11,49 +11,9 @@ angular.module('quay').directive('buildMessage', function () { scope: { 'phase': '=phase' }, - controller: function($scope, $element) { + controller: function($scope, $element, BuildService) { $scope.getBuildMessage = function (phase) { - switch (phase) { - case 'cannot_load': - return 'Cannot load build status'; - - case 'starting': - case 'initializing': - return 'Starting Dockerfile build'; - - case 'waiting': - return 'Waiting for available build worker'; - - case 'unpacking': - return 'Unpacking build package'; - - case 'pulling': - return 'Pulling base image'; - - case 'building': - return 'Building image from Dockerfile'; - - case 'checking-cache': - return 'Looking up cached images'; - - case 'priming-cache': - return 'Priming cache for build'; - - case 'build-scheduled': - return 'Preparing build node'; - - case 'pushing': - return 'Pushing image built from Dockerfile'; - - case 'complete': - return 'Dockerfile build completed and pushed'; - - case 'error': - return 'Dockerfile build failed'; - - case 'internalerror': - return 'An internal system error occurred while building; the build will be retried in the next few minutes.'; - } + return BuildService.getBuildMessage(phase); }; } }; diff --git a/static/js/directives/ui/build-state-icon.js b/static/js/directives/ui/build-state-icon.js index 7b3df6ca7..7f6a07bb9 100644 --- a/static/js/directives/ui/build-state-icon.js +++ b/static/js/directives/ui/build-state-icon.js @@ -11,10 +11,10 @@ angular.module('quay').directive('buildStateIcon', function () { scope: { 'build': '=build' }, - controller: function($scope, $element) { + controller: function($scope, $element, BuildService) { $scope.isBuilding = function(build) { if (!build) { return true; } - return build.phase != 'complete' && build.phase != 'error'; + return BuildService.isActive(build); }; } }; diff --git a/static/js/pages/build-view.js b/static/js/pages/build-view.js index 34653652a..b96d364c0 100644 --- a/static/js/pages/build-view.js +++ b/static/js/pages/build-view.js @@ -66,10 +66,5 @@ $scope.setUpdatedBuild = function(build) { $scope.build = build; }; - - $scope.isBuilding = function(build) { - if (!build) { return true; } - return build.phase != 'complete' && build.phase != 'error' && build.phase != 'internalerror'; - }; } })(); diff --git a/static/js/services/build-service.js b/static/js/services/build-service.js new file mode 100644 index 000000000..280419b06 --- /dev/null +++ b/static/js/services/build-service.js @@ -0,0 +1,58 @@ +/** + * Service which provides helper methods for reasoning about builds. + */ +angular.module('quay').factory('BuildService', [function() { + var buildService = {} + buildService.isActive = function(build) { + return build.phase != 'complete' && build.phase != 'error' && build.phase != 'expired'; + }; + + buildService.getBuildMessage = function(phase) { + switch (phase) { + case 'cannot_load': + return 'Cannot load build status'; + + case 'starting': + case 'initializing': + return 'Starting Dockerfile build'; + + case 'waiting': + return 'Waiting for available build worker'; + + case 'unpacking': + return 'Unpacking build package'; + + case 'pulling': + return 'Pulling base image'; + + case 'building': + return 'Building image from Dockerfile'; + + case 'checking-cache': + return 'Looking up cached images'; + + case 'priming-cache': + return 'Priming cache for build'; + + case 'build-scheduled': + return 'Preparing build node'; + + case 'pushing': + return 'Pushing image built from Dockerfile'; + + case 'complete': + return 'Dockerfile build completed and pushed'; + + case 'error': + return 'Dockerfile build failed'; + + case 'expired': + return 'Build did not complete after 3 attempts. Re-submit this build to try again.'; + + case 'internalerror': + return 'An internal system error occurred while building; the build will be retried in the next few minutes.'; + } + }; + + return buildService; +}]); diff --git a/static/partials/build-view.html b/static/partials/build-view.html index d7e934936..2fbf99750 100644 --- a/static/partials/build-view.html +++ b/static/partials/build-view.html @@ -28,12 +28,7 @@
- - - - - - +