Skip to content

Commit 1ca5117

Browse files
Merge branch '4.x' into release-docs-automation
2 parents 2b57eb8 + 5d0ea74 commit 1ca5117

File tree

5 files changed

+81
-13
lines changed

5 files changed

+81
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This projec
33

44
## 4.0.4-dev
55

6+
### Added
7+
8+
- Add "PHP Runtime Generation" (php_runtime_generation) and "PHP Version" (php_version) to the `env:list` command (#2729, #2732)
9+
610
## 4.0.3 - 2025-09-11
711

812
### Added

src/Commands/Env/ListCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ class ListCommand extends TerminusCommand implements SiteAwareInterface
3434
* connection_mode: Connection Mode
3535
* locked: Locked
3636
* initialized: Initialized
37-
* @return RowsOfFields
37+
* php_version: PHP Version
38+
* php_runtime_generation: PHP Runtime Generation
39+
* @default-fields id,created,domain,connection_mode,locked,initialized
40+
41+
* @return RowsOfFields
3842
*
3943
* @param string $site_id Site name
4044
*

src/Commands/Workflow/WaitCommand.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,20 @@ protected function waitForWorkflow(
111111
do {
112112
$current_time = time();
113113
if ($maxNotFoundAttempts && $not_found_attempts === $maxNotFoundAttempts) {
114-
throw new TerminusException(
114+
$this->log()->warning(
115115
"Attempted '{max}' times, giving up waiting for workflow to be found",
116116
['max' => $maxNotFoundAttempts]
117117
);
118+
return;
118119
}
119120

120-
// Check if the timeout has been reached and throw an exception if so.
121+
// Check if the timeout has been reached and log warning if so.
121122
if ($end_time > 0 && $current_time >= $end_time) {
122-
throw new TerminusException(
123-
'Workflow timed out after {timeout} seconds.',
123+
$this->log()->warning(
124+
'Waited \'{timeout}\' seconds, giving up waiting for workflow to finish',
124125
['timeout' => $maxWaitInSeconds]
125126
);
127+
return;
126128
}
127129
$site = $this->getSiteById($site->id);
128130
$workflows->reset();
@@ -171,10 +173,11 @@ protected function waitForWorkflow(
171173
}
172174
do {
173175
if ($end_time > 0 && $current_time >= $end_time) {
174-
throw new TerminusException(
175-
'Workflow timed out after {timeout} seconds.',
176+
$this->log()->warning(
177+
'Waited \'{timeout}\' seconds, giving up waiting for workflow to finish',
176178
['timeout' => $maxWaitInSeconds]
177179
);
180+
return;
178181
}
179182
$workflow->fetch();
180183
usleep($retry_interval * 1000);
@@ -226,10 +229,11 @@ protected function waitForCommit(
226229

227230
// Check timeout
228231
if ($end_time > 0 && $current_time >= $end_time) {
229-
throw new TerminusException(
230-
'Workflow with commit {commit} timed out after {timeout} seconds.',
232+
$this->log()->warning(
233+
'Waited \'{timeout}\' seconds, giving up waiting for workflow with commit {commit} to finish',
231234
['commit' => $target_commit, 'timeout' => $maxWaitInSeconds]
232235
);
236+
return;
233237
}
234238

235239
// Fetch workflow logs using the logs/workflows endpoint
@@ -281,10 +285,11 @@ protected function waitForCommit(
281285

282286
$retry_count++;
283287
if ($retry_count >= $max_retries) {
284-
throw new TerminusException(
288+
$this->log()->warning(
285289
'Workflow with commit {commit} not found after {retries} attempts.',
286290
['commit' => $target_commit, 'retries' => $max_retries]
287291
);
292+
return;
288293
}
289294

290295
$this->log()->debug('Workflow not found, retrying... ({retry}/{max})', [
@@ -305,10 +310,11 @@ protected function waitForCommit(
305310
do {
306311
$current_time = time();
307312
if ($end_time > 0 && $current_time >= $end_time) {
308-
throw new TerminusException(
309-
'Workflow timed out after {timeout} seconds.',
313+
$this->log()->warning(
314+
'Waited \'{timeout}\' seconds, giving up waiting for workflow to finish',
310315
['timeout' => $maxWaitInSeconds]
311316
);
317+
return;
312318
}
313319

314320
// Re-fetch workflow logs to get updated status

src/Models/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ public function getPHPVersion()
690690
*/
691691
public function getPHPRuntimeGeneration()
692692
{
693-
return $this->settings('appserver_runtime')->php_runtime_generation;
693+
return $this->settings('appserver_runtime')->php_runtime_generation;
694694
}
695695

696696
/**

tests/Functional/EnvCommandsTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,60 @@ public function testListCommand()
457457
);
458458
}
459459

460+
/**
461+
* @test
462+
* @covers \Pantheon\Terminus\Commands\Env\ListCommand
463+
*
464+
* @group env
465+
* @group short
466+
*/
467+
public function testListCommandWithPHPRuntimeGeneration()
468+
{
469+
$envs = $this->terminusJsonResponse(
470+
sprintf('env:list %s --fields=id,php_runtime_generation', $this->getSiteName())
471+
);
472+
$this->assertIsArray($envs);
473+
$env = array_shift($envs);
474+
475+
$this->assertArrayHasKey(
476+
'id',
477+
$env,
478+
'An environment should have "id" field.'
479+
);
480+
$this->assertArrayHasKey(
481+
'php_runtime_generation',
482+
$env,
483+
'An environment should have "php_runtime_generation" field when explicitly requested.'
484+
);
485+
}
486+
487+
/**
488+
* @test
489+
* @covers \Pantheon\Terminus\Commands\Env\ListCommand
490+
*
491+
* @group env
492+
* @group short
493+
*/
494+
public function testListCommandWithPHPVersion()
495+
{
496+
$envs = $this->terminusJsonResponse(
497+
sprintf('env:list %s --fields=id,php_version', $this->getSiteName())
498+
);
499+
$this->assertIsArray($envs);
500+
$env = array_shift($envs);
501+
502+
$this->assertArrayHasKey(
503+
'id',
504+
$env,
505+
'An environment should have "id" field.'
506+
);
507+
$this->assertArrayHasKey(
508+
'php_version',
509+
$env,
510+
'An environment should have "php_version" field when explicitly requested.'
511+
);
512+
}
513+
460514
/**
461515
* @test
462516
* @covers \Pantheon\Terminus\Commands\Env\ViewCommand

0 commit comments

Comments
 (0)