Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitBucket build improvements. #776

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,43 @@ function devshop_bitbucket_hosting_task_update_status($task, $status) {
]), 'debug');

$t = [
'@env' => "{$task->ref->hosting_group}.{$task->ref->hosting_environment}"
'@action' => $task->task_type == 'install'? t('Install'):
($task->task_type == 'test'? t('Test'):
(!empty($task->task_args['test'])? t('Test'): t('Deploy'))),
'@env' => $task->ref->hosting_environment,
];

if ($status == HOSTING_TASK_PROCESSING) {
$params->state = $state = 'INPROGRESS';
$params->name = t('DevShop Deploy to @env: In Progress', $t);
$params->name = t('@action started: @env', $t);
}
elseif ($status == HOSTING_TASK_SUCCESS || $status == HOSTING_TASK_WARNING) {
$params->state = $state = 'SUCCESSFUL';
if ($status == HOSTING_TASK_SUCCESS) {
$params->name = t('DevShop Deploy to @env: Success', $t);
$params->name = t('@action Success: @env', $t);
}
else {
$params->name = t('DevShop Deploy to @env: Success (with warnings)', $t);
$params->name = t('@action Success (with warnings): @env', $t);
}
}
else {
$params->state = $state = 'FAILED';
$params->name = t('DevShop Deploy to @env: Failed', $t);
$params->name = t('@action Failed: @env', $t);
}

$params->key = "deploy.{$task->ref->hosting_group}.{$task->ref->hosting_environment}";
$params->url = $task->ref->url;
$params->description = url("node/$task->nid", ['absolute' => true]);
$params->url = url("node/$task->nid", ['absolute' => true]);
$params->description = $task->ref->url;

$build_status = $client->repositories()->workspaces($environment->bitbucket_owner)->commit($environment->bitbucket_repo)->statuses($sha)->build()->create((array) $params);

if (!empty($build_status)) {
drush_log("Build status: " . print_r($build_status,1), 'debug');
drush_log(t("Posted @state build status to BitBucket for commit @commit @url", [
'@state' => $build_status['state'],
'@commit' => $build_status['commit']['hash'],
'@url' => $build_status['commit']['links']['html']['href'],
]), 'p_log');
}

} catch (\Exception $e) {
Expand Down
7 changes: 7 additions & 0 deletions devmaster/modules/devshop/devshop_projects/inc/theme.inc
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,13 @@ function devshop_task_get_messages($task_node) {
}

if (!empty($command)) {

// Make URLs clickable:
$filter = new stdClass();
$filter->settings = [
'filter_url_length' => 1000,
];
$command = _filter_url($command, $filter);
$header = "<div class='panel-heading'><i class='fa fa-$icon pull-left'></i> $command</div>";
}
else {
Expand Down
Loading