Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(helper): hide deployment details unless explicitly requested

Andras Bacsai776c56f9471c
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index f40c51a335..a7a606330e 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -2400,7 +2400,7 @@ function get_public_ips()
}
}
-function isAnyDeploymentInprogress()
+function isAnyDeploymentInprogress(bool $showAll = false)
{
$runningJobs = ApplicationDeploymentQueue::where('horizon_job_worker', gethostname())->where('status', ApplicationDeploymentStatus::IN_PROGRESS->value)->get();
@@ -2417,34 +2417,31 @@ function isAnyDeploymentInprogress()
if ($horizonJobStatus === 'unknown' || $horizonJobStatus === 'reserved') {
$horizonJobIds[] = $runningJob->horizon_job_id;
- // Get application and team information
- $application = Application::find($runningJob->application_id);
- $teamMembers = [];
- $deploymentUrl = '';
+ if ($showAll) {
+ $application = Application::find($runningJob->application_id);
+ $teamMembers = [];
+ $deploymentUrl = '';
- if ($application) {
- // Get team members through the application's project
- $team = $application->team();
- if ($team) {
- $teamMembers = $team->members()->pluck('email')->toArray();
- }
+ if ($application) {
+ $team = $application->team();
+ if ($team) {
+ $teamMembers = $team->members()->pluck('email')->toArray();
+ }
- // Construct the full deployment URL
- if ($runningJob->deployment_url) {
- $baseUrl = base_url();
- $deploymentUrl = $baseUrl.$runningJob->deployment_url;
+ if ($runningJob->deployment_url) {
+ $deploymentUrl = base_url().$runningJob->deployment_url;
+ }
}
- }
- $deploymentDetails[] = [
- 'id' => $runningJob->id,
- 'application_name' => $runningJob->application_name ?? 'Unknown',
- 'server_name' => $runningJob->server_name ?? 'Unknown',
- 'deployment_url' => $deploymentUrl,
- 'team_members' => $teamMembers,
- 'created_at' => $runningJob->created_at->format('Y-m-d H:i:s'),
- 'horizon_job_id' => $runningJob->horizon_job_id,
- ];
+ $deploymentDetails[] = [
+ 'application_name' => $runningJob->application_name ?? 'Unknown',
+ 'server_name' => $runningJob->server_name ?? 'Unknown',
+ 'deployment_url' => $deploymentUrl,
+ 'team_members' => $teamMembers,
+ 'created_at' => $runningJob->created_at->format('Y-m-d H:i:s'),
+ 'horizon_job_id' => $runningJob->horizon_job_id,
+ ];
+ }
}
}
@@ -2453,28 +2450,39 @@ function isAnyDeploymentInprogress()
exit(0);
}
- // Display enhanced deployment information
- echo "\n=== Running Deployments ===\n";
- echo 'Total active deployments: '.count($horizonJobIds)."\n\n";
+ echo formatRunningDeploymentsOutput(count($horizonJobIds), $deploymentDetails, $showAll);
+
+ exit(1);
+}
+
+function formatRunningDeploymentsOutput(int $activeDeploymentCount, array $deploymentDetails = [], bool $showAll = false): string
+{
+ $output = "\n=== Running Deployments ===\n";
+ $output .= 'Total active deployments: '.$activeDeploymentCount."\n";
+
+ if (! $showAll) {
+ return $output;
+ }
+
+ $output .= "\n";
foreach ($deploymentDetails as $index => $deployment) {
- echo 'Deployment #'.($index + 1).":\n";
- echo ' Application: '.$deployment['application_name']."\n";
- echo ' Server: '.$deployment['server_name']."\n";
- echo ' Started: '.$deployment['created_at']."\n";
+ $output .= 'Deployment #'.($index + 1).":\n";
+ $output .= ' Application: '.$deployment['application_name']."\n";
+ $output .= ' Server: '.$deployment['server_name']."\n";
+ $output .= ' Started: '.$deployment['created_at']."\n";
if ($deployment['deployment_url']) {
- echo ' URL: '.$deployment['deployment_url']."\n";
+ $output .= ' URL: '.$deployment['deployment_url']."\n";
}
if (! empty($deployment['team_members'])) {
- echo ' Team members: '.implode(', ', $deployment['team_members'])."\n";
+ $output .= ' Team members: '.implode(', ', $deployment['team_members'])."\n";
} else {
- echo " Team members: No team members found\n";
+ $output .= " Team members: No team members found\n";
}
- echo ' Horizon Job ID: '.$deployment['horizon_job_id']."\n";
- echo "\n";
+ $output .= ' Horizon Job ID: '.$deployment['horizon_job_id']."\n\n";
}
- exit(1);
+ return $output;
}
function isBase64Encoded($strValue)
diff --git a/tests/Unit/RunningDeploymentsOutputTest.php b/tests/Unit/RunningDeploymentsOutputTest.php
new file mode 100644
index 0000000000..62d367514c
--- /dev/null
+++ b/tests/Unit/RunningDeploymentsOutputTest.php
@@ -0,0 +1,38 @@
+<?php
+
+it('shows only the active deployment count by default', function () {
+ $output = formatRunningDeploymentsOutput(1, [[
+ 'application_name' => 'secret-application',
+ 'server_name' => 'secret-server',
+ 'deployment_url' => 'https://example.com/secret-deployment',
+ 'team_members' => ['[email protected]'],
+ 'created_at' => '2026-09-15 08:52:42',
+ 'horizon_job_id' => 'secret-job-id',
+ ]]);
+
+ expect($output)
+ ->toBe("\n=== Running Deployments ===\nTotal active deployments: 1\n")
+ ->not->toContain('secret-application')
+ ->not->toContain('https://example.com/secret-deployment')
+ ->not->toContain('[email protected]');
+});
+
+it('shows all deployment details when requested', function () {
+ $output = formatRunningDeploymentsOutput(1, [[
+ 'application_name' => 'example-application',
+ 'server_name' => 'example-server',
+ 'deployment_url' => 'https://example.com/deployment',
+ 'team_members' => ['[email protected]'],
+ 'created_at' => '2026-09-15 08:52:42',
+ 'horizon_job_id' => 'example-job-id',
+ ]], true);
+
+ expect($output)
+ ->toContain('Deployment #1:')
+ ->toContain('Application: example-application')
+ ->toContain('Server: example-server')
+ ->toContain('Started: 2026-09-15 08:52:42')
+ ->toContain('URL: https://example.com/deployment')
+ ->toContain('Team members: [email protected]')
+ ->toContain('Horizon Job ID: example-job-id');
+});