diff --git a/app/Http/Controllers/Webhook/Bitbucket.php b/app/Http/Controllers/Webhook/Bitbucket.php index 485720c23..7b569c278 100644 --- a/app/Http/Controllers/Webhook/Bitbucket.php +++ b/app/Http/Controllers/Webhook/Bitbucket.php @@ -47,7 +47,7 @@ class Bitbucket extends Controller if ($x_bitbucket_event === 'repo:push') { $branch = data_get($payload, 'push.changes.0.new.name'); $full_name = data_get($payload, 'repository.full_name'); - + $commit = data_get($payload, 'push.changes.0.new.target.hash'); if (!$branch) { return response([ 'status' => 'failed', @@ -104,6 +104,7 @@ class Bitbucket extends Controller queue_application_deployment( application: $application, deployment_uuid: $deployment_uuid, + commit: $commit, force_rebuild: false, is_webhook: true ); diff --git a/app/Http/Controllers/Webhook/Github.php b/app/Http/Controllers/Webhook/Github.php index 214843aab..baa23deec 100644 --- a/app/Http/Controllers/Webhook/Github.php +++ b/app/Http/Controllers/Webhook/Github.php @@ -129,6 +129,7 @@ class Github extends Controller application: $application, deployment_uuid: $deployment_uuid, force_rebuild: false, + commit: data_get($payload, 'after', 'HEAD'), is_webhook: true, ); $return_payloads->push([ @@ -177,6 +178,7 @@ class Github extends Controller pull_request_id: $pull_request_id, deployment_uuid: $deployment_uuid, force_rebuild: false, + commit: data_get($payload, 'head.sha', 'HEAD'), is_webhook: true, git_type: 'github' ); @@ -338,6 +340,7 @@ class Github extends Controller queue_application_deployment( application: $application, deployment_uuid: $deployment_uuid, + commit: data_get($payload, 'after', 'HEAD'), force_rebuild: false, is_webhook: true, ); @@ -387,6 +390,7 @@ class Github extends Controller pull_request_id: $pull_request_id, deployment_uuid: $deployment_uuid, force_rebuild: false, + commit: data_get($payload, 'head.sha', 'HEAD'), is_webhook: true, git_type: 'github' ); diff --git a/app/Http/Controllers/Webhook/Gitlab.php b/app/Http/Controllers/Webhook/Gitlab.php index 763f95bbc..dfa9394eb 100644 --- a/app/Http/Controllers/Webhook/Gitlab.php +++ b/app/Http/Controllers/Webhook/Gitlab.php @@ -133,6 +133,7 @@ class Gitlab extends Controller queue_application_deployment( application: $application, deployment_uuid: $deployment_uuid, + commit: data_get($payload, 'after', 'HEAD'), force_rebuild: false, is_webhook: true, ); @@ -182,6 +183,7 @@ class Gitlab extends Controller application: $application, pull_request_id: $pull_request_id, deployment_uuid: $deployment_uuid, + commit: data_get($payload, 'object_attributes.last_commit.id', 'HEAD'), force_rebuild: false, is_webhook: true, git_type: 'gitlab' diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 69bfa29d0..8c7695f92 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1113,6 +1113,8 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted } if ($this->saved_outputs->get('git_commit_sha') && !$this->rollback) { $this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t"); + $this->application_deployment_queue->commit = $this->commit; + $this->application_deployment_queue->save(); } } private function clone_repository()