Skip to content

Commit

Permalink
Fix bitbucket build integration. (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpugh authored Sep 27, 2023
1 parent c69fc37 commit 8550b38
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ function drush_devshop_bitbucket_pre_hosting_task()
* Implements hook_hosting_task_update_status().
*/
function devshop_bitbucket_hosting_task_update_status($task, $status) {
// Only trigger deployments for the specified tasks.
// Every type of task listed here will have a GitHub "deployment" object
// created for it, and that deployment will have it's status updated.
if (empty($task->ref->environment) || $task->ref->environment->git_provider != 'bitbucket' || !in_array($task->task_type, variable_get('devshop_bitbucket_deployment_tasks', array(
'deploy',
'install',
'test'
)))) {
return;
}

if (($task->task_type == 'install' || $task->task_type == 'deploy' || $task->task_type == 'test') && !empty($task->ref->environment)) {
$task->ref = node_load($task->rid);
$environment = $task->ref->environment;

if (empty($task->ref->environment) || empty($task->ref->environment->bitbucket_owner)) {
return;
}

if (!file_exists($task->ref->git_root)) {
return;
}
Expand All @@ -34,7 +39,7 @@ function devshop_bitbucket_hosting_task_update_status($task, $status) {
$params = new stdClass();

$command = "git ls-remote origin {$task->ref->git_reference}";
list($sha, $null) = explode(' ', provision_process($command));
list($sha, $null) = explode(' ', provision_process($command, $task->ref->git_root));

drush_log(dt('Found remote SHA of %sha for branch %ref with command: %command', [
'%sha' => $sha,
Expand Down Expand Up @@ -77,5 +82,4 @@ function devshop_bitbucket_hosting_task_update_status($task, $status) {
} catch (\Exception $e) {
return drush_set_error(DRUSH_APPLICATION_ERROR, 'bitbucket API Error: ' . $e->getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ function devshop_github_hosting_task_update_status($task, $status) {
// Only trigger deployments for the specified tasks.
// Every type of task listed here will have a GitHub "deployment" object
// created for it, and that deployment will have it's status updated.
if (!in_array($task->task_type, variable_get('devshop_github_deployment_tasks', array(
'devshop-deploy',
if (empty($task->ref->environment) || $task->ref->environment->git_provider != 'github' || !in_array($task->task_type, variable_get('devshop_github_deployment_tasks', array(
'deploy',
'install',
'test'
)))) {
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ services:
DEVSHOP_ANSIBLE_GROUP_NAME: devshop_remote
ANSIBLE_EXTRA_VARS:
ANSIBLE_PLAYBOOK_COMMAND_OPTIONS:

#
12 changes: 0 additions & 12 deletions roles/opendevshop.devmaster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@
name: safe.directory
value: "{{ devshop_cli_path }}"

- name: "Retrieve git information"
git:
repo: "{{ devshop_cli_repo }}"
dest: "{{ devshop_cli_path }}"
clone: no
update: no
register: devshop_installed_git_info

- name: Git Information
debug:
msg: "{{ devshop_installed_git_info }}"

- name: Detect currently installed version of DevShop.
command: "{{ devshop_cli_path }}/scripts/branch-or-tag"
register: __devshop_version_installed
Expand Down

0 comments on commit 8550b38

Please sign in to comment.