diff --git a/modules/simplytest_tugboat/assets/simplytest_tugboat_status.js b/modules/simplytest_tugboat/assets/simplytest_tugboat_status.js index aaade81..7163704 100644 --- a/modules/simplytest_tugboat/assets/simplytest_tugboat_status.js +++ b/modules/simplytest_tugboat/assets/simplytest_tugboat_status.js @@ -31,6 +31,7 @@ }, 1000); $('.percentage', progressbar).html(data.percent + '%'); $('.message', progressbar).html(data.message); + $('.log', progressbar).html(data.instanceLog); if (data.percent == 100) { // Putting in an intentional delay to let the tugboat API return the URL and STM to process it. diff --git a/modules/simplytest_tugboat/simplytest_tugboat.instance_status.inc b/modules/simplytest_tugboat/simplytest_tugboat.instance_status.inc index a264472..7dfeca1 100644 --- a/modules/simplytest_tugboat/simplytest_tugboat.instance_status.inc +++ b/modules/simplytest_tugboat/simplytest_tugboat.instance_status.inc @@ -249,6 +249,11 @@ function simplytest_tugboat_status_progress_page($id) { '#percent' => $state['percent'], '#message' => $state['message'], ), + 'log' => array( + '#prefix' => '
' . $log_entry['message'] . '
'; + $log[] = $message; + } + return $log; +} + /** * Call tugboat and start spawning the new instance. * @@ -254,7 +293,7 @@ function _simplytest_tugboat_execute_tugboat($instance_id) { simplytest_tugboat_status_update($instance_id, SIMPLYTEST_STATUS_PREPARE); // Load the ID of the correct base preview ID. - $base_preview_id = simplytest_tugboat_load_preview_id($context); + $base_preview_id = simplytest_tugboat_load_preview_id($context, TRUE); watchdog('message', 'Trying to load base preview ' . $base_preview_id); @@ -294,8 +333,12 @@ function _simplytest_tugboat_execute_tugboat($instance_id) { * @param $context * @return string */ -function simplytest_tugboat_load_preview_id($context) { - $branch_name = 'base-' . $context; +function simplytest_tugboat_load_preview_id($context, $base = TRUE) { + if ($base) { + $branch_name = 'base-' . $context; + } else { + $branch_name = $context; + } $previews = array(); $error_string = ''; $return_status = _tugboat_execute("ls previews", $previews, $error_string); @@ -306,11 +349,22 @@ function simplytest_tugboat_load_preview_id($context) { $max_id = NULL; // Find the most recent preview ID for the base. - $acceptable_states = array( - 'ready', - 'suspended', - 'refreshing', - ); + if ($base) { + $acceptable_states = array( + 'ready', + 'suspended', + 'refreshing', + ); + } else { + $acceptable_states = array( + 'building', + 'pending', + 'new', + 'ready', + 'suspended', + 'refreshing', + ); + } $repo = variable_get('simplytest_tugboat_github_repo'); $ns = variable_get('simplytest_tugboat_github_ns'); $repo_filter = 'https://github.com/' . $ns . '/' . $repo; @@ -329,9 +383,15 @@ function simplytest_tugboat_load_preview_id($context) { // Throw error if ID not found if (empty($max_id)) { - watchdog('simplytest_tugboat', 'No base preview for: %sid', array( - '%sid' => $context, - ), WATCHDOG_ERROR); + if ($base) { + watchdog('simplytest_tugboat', 'No base preview for: %sid', array( + '%sid' => $context, + ), WATCHDOG_ERROR); + } else { + watchdog('simplytest_tugboat', 'No preview for: %sid', array( + '%sid' => $context, + ), WATCHDOG_ERROR); + } } return $max_id; }