Skip to content

Commit a4fae12

Browse files
Merge in 4.x changes
2 parents 908a69a + a141960 commit a4fae12

File tree

169 files changed

+2168
-7581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+2168
-7581
lines changed

.env.dist

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
11
export PROJECT_PATH=$(realpath .)
2-
## Note: The terminus test site must have some quicksilver scripts enabled
3-
## in order for tests to pass.
4-
## Needed for unit test fixutures
5-
export TERMINUS_PROJECT_ROOT=${PROJECT_PATH}
6-
7-
## This is the site that will be used for testing
8-
export TERMINUS_SITE="ci-terminus-composer"
9-
10-
## This is the site that will be used for testing wordpress commands
2+
export TERMINUS_SITE="terminus-test-site"
113
export TERMINUS_SITE_WP="terminus-test-site-wordpress"
12-
13-
## This is the site that will be used for testing wordpress network
144
export TERMINUS_SITE_WP_NETWORK="terminus-test-site-wp-network"
15-
16-
## This is the site that will be used for cloning a test environment on which to run tests
175
export TERMINUS_ENV="dev"
18-
19-
## this is the org that will be used. The site(s) above need to be in this org
206
export TERMINUS_ORG="Agency"
21-
22-
## This is the user that will be used for testing Should be attached the token below
237
export TERMINUS_USER="[email protected]"
24-
258
## To Autoload your token from your local machine, change the TERMINUS_TOKEN to the following command:
269
## export TERMINUS_TOKEN=$(cat $HOME/.terminus/cache/tokens/[email protected] | jq -r .token)
2710
export TERMINUS_TOKEN="{TERMINUS TOKEN}"
28-
29-
## this is the folder that terminus will use to store its data during the tests
3011
export TERMINUS_BASE_DIR="/tmp/terminus-data"
31-
32-
## this is the folder that terminus will use to store its plugins during the tests
3312
export TERMINUS_PLUGINS2_DIR="${TERMINUS_BASE_DIR}/plugins"
34-
35-
## this is the folder that terminus will use to store its plugins during the tests
3613
export TERMINUS_PLUGINS_DIR="${TERMINUS_BASE_DIR}/plugins-3.x"
37-
38-
## Used for testing plugins
3914
export TERMINUS_DEPENDENCIES_BASE_DIR="${TERMINUS_BASE_DIR}/dependencies-1"
40-
41-
## this will prevent the tests from creating a test environment for the run
4215
export TERMINUS_TESTING_RUNTIME_ENV=
43-
44-
## this will prevent tests from reinstalling the development packages once a phar is built
4516
export TERMINUS_ON_PHAR_COMPLETE_REINSTALL_COMPOSER_WITH_DEV=1

.github/workflows/3x.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
name: Terminus 3.x
1+
name: Terminus 4.x
22
on:
33
push:
4-
schedule:
5-
- cron: '0 6 * * *'
64
workflow_dispatch:
75
inputs:
86
functional_tests_group:
@@ -24,18 +22,18 @@ jobs:
2422
checkout_build:
2523
runs-on: ubuntu-latest
2624
container:
27-
image: quay.io/pantheon-public/php-ci:v7.4
25+
image: quay.io/pantheon-public/php-ci:v8.2
2826
name: Checkout & build Phar
2927
steps:
3028
- name: Checkout
31-
uses: actions/checkout@v4
29+
uses: actions/checkout@v3
3230
- name: Save repo content as artifact
3331
uses: actions/upload-artifact@v4
3432
with:
3533
name: full-workspace
3634
path: ${{ github.workspace }}
3735
- name: Full Composer Install
38-
run: composer install --dev
36+
run: composer install
3937
- name: Validate Code
4038
run: composer code:lint
4139
- name: Phar Build
@@ -58,7 +56,7 @@ jobs:
5856
strategy:
5957
matrix:
6058
operating-system: [ 'macos-latest' ]
61-
php-versions: [ '7.4', '8.2', '8.3' ]
59+
php-versions: [ '8.2', '8.4' ]
6260
max-parallel: 1
6361
env:
6462
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
@@ -127,7 +125,7 @@ jobs:
127125
runs-on: ubuntu-latest
128126
name: Release
129127
container:
130-
image: quay.io/pantheon-public/php-ci:v7.4
128+
image: quay.io/pantheon-public/php-ci:v8.2
131129
needs: [ functional ]
132130
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }}
133131
steps:

CHANGELOG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
11
# Change Log
22
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org)
33

4-
## 3.6.2-dev -
4+
## 4.0.2-dev
5+
6+
## 4.0.1 - 2025-05-19
7+
8+
### Fixed
9+
10+
- env:code-rebuild command should no longer throw a fatal error (#2694)
11+
12+
## 4.0.0 - 2025-05-07
13+
14+
### Added
15+
16+
- Readd update check and prompt to update when running an old Terminus version (#2669)
17+
- Prompt for missing required arguments when in interactive mode (#2684)
18+
19+
### Fixed
20+
21+
- Response json_decode should fallback to original body text (#2687)
22+
- Simplify env:wake command (#2689)
23+
24+
## 4.0.0-alpha1 - 2025-03-06
25+
26+
### Added
27+
28+
- Support for PHP 8.4
29+
30+
### Removed
31+
32+
- Support for PHP versions prior to 8.2
33+
34+
## 3.6.2 - 2025-03-03
35+
- Pass verbose flag to ssh if terminus is in verbose mode (#2663)
36+
- Bug fix: backup:restore with --file parameter restores backups multiple ties (#2664)
537

638
## 3.6.1 - 2024-12-04
739

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ A PHAR file must also be built before running tests.
7575

7676
The functional test files are in the `tests/Functional` directory.
7777

78-
The Terminus 3.x functional tests can be run via:
78+
The Terminus 4.x functional tests can be run via:
7979

8080
```bash
8181
cd /install/location/terminus

RoboFile.php

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use CzProject\GitPhp\Git;
4-
use CzProject\GitPhp\GitException;
53
use Pantheon\Terminus\Config\ConfigAwareTrait;
64
use Pantheon\Terminus\Helpers\CommandCoverageReport;
75
use Pantheon\Terminus\Terminus;
@@ -208,124 +206,6 @@ public function setTerminus(Terminus $terminus): void
208206
$this->terminus = $terminus;
209207
}
210208

211-
/**
212-
* Generates a test commit.
213-
*
214-
* @throws \Pantheon\Terminus\Exceptions\TerminusException
215-
* @throws GitException
216-
*/
217-
public function generateTestCommit()
218-
{
219-
$this->output()->writeln('Getting the Site Repo');
220-
// get the git host and port from terminus
221-
$commandResponse = $this->getTerminus()->execute(
222-
'%s connection:info %s.dev --fields=git_host,git_port --format=json',
223-
[
224-
$this->getProjectPath() . "/terminus.phar",
225-
$this->getSiteName(),
226-
]
227-
);
228-
229-
// check if the command was successful
230-
if ($commandResponse[1] !== 0) {
231-
$this->output()->writeln('Failed to retrieve git host and port');
232-
exit(1);
233-
}
234-
235-
// decode the json response
236-
$gitInfo = json_decode($commandResponse[0], true);
237-
$this->output()->writeln('Retrieved git host and port' . print_r($gitInfo, true));
238-
239-
// check if the git host and port were retrieved
240-
if (!isset($gitInfo['git_host']) || !isset($gitInfo['git_port'])) {
241-
$this->output()->writeln('Failed to retrieve git host and port');
242-
exit(1);
243-
}
244-
245-
// Does the known_hosts file exist?
246-
if (!file_exists(sprintf("%s/.ssh/known_hosts", getenv("HOME")))) {
247-
// if not, create one
248-
touch(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
249-
}
250-
251-
// get the contents of the known_hosts file
252-
$knownHosts = file_get_contents(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
253-
// check if the git host is already in the known_hosts file
254-
if (!str_contains($knownHosts, $gitInfo['git_host'])) {
255-
// if not, add it
256-
$this->output()->writeln('Adding the git host to known hosts file');
257-
$addGitHostToKnownHostsCommand = sprintf(
258-
'ssh-keyscan -p %d %s >> ~/.ssh/known_hosts',
259-
$gitInfo['git_port'],
260-
$gitInfo['git_host']
261-
);
262-
$this->output()->writeln($addGitHostToKnownHostsCommand);
263-
exec($addGitHostToKnownHostsCommand);
264-
}
265-
266-
// checkout the branch related to this test run
267-
$clonedPath = sprintf(
268-
"%s/pantheon-local-copies/%s",
269-
getenv("HOME"),
270-
$this->getSiteName()
271-
);
272-
if (is_dir($clonedPath)) {
273-
// make sure you're working with a clean copy of the repo
274-
exec("rm -rf {$clonedPath}");
275-
}
276-
$this->output()->writeln(sprintf('Cloning the site repository to %s', $clonedPath));
277-
// get the git host and port from terminus
278-
$commandResponse = $this->getTerminus()->execute(
279-
'%s local:clone %s',
280-
[
281-
$this->getProjectPath() . "/terminus.phar",
282-
$this->getSiteName(),
283-
]
284-
);
285-
286-
$response = "";
287-
try {
288-
$git = new Git();
289-
$repo = $git->open($clonedPath);
290-
chdir($clonedPath);
291-
$branches = $repo->getBranches();
292-
if (!in_array($this->getSiteEnv(), $branches)) {
293-
$this->output()->writeln(sprintf('Creating the %s branch', $this->getSiteEnv()));
294-
// Create the branch
295-
$repo->createBranch($this->getSiteEnv());
296-
}
297-
// Check out the branch in question
298-
$repo->checkout($this->getSiteEnv());
299-
// create a text file
300-
$testFilePath = sprintf('%s/test.txt', $clonedPath);
301-
file_put_contents($testFilePath, 'test');
302-
// add the file to the repository
303-
$repo->addFile("test.txt");
304-
// commit the file
305-
$repo->commit('Test commit');
306-
// push the commit
307-
$response = $repo->execute(
308-
'push',
309-
'origin',
310-
$this->getSiteEnv(),
311-
);
312-
} catch (GitException $e) {
313-
$this->output()->writeln(["Git Exception:", $e->getMessage()]);
314-
$this->output()->writeln(print_r($response, true));
315-
exit(1);
316-
} catch (Exception $e) {
317-
$this->output()->writeln($e->getMessage());
318-
$this->output()->writeln(print_r($response, true));
319-
exit(1);
320-
}
321-
322-
// get the last commit
323-
$commit = $repo->getLastCommit();
324-
// output the commit id
325-
$this->output()->writeln($commit->getId());
326-
return $commit->getId();
327-
}
328-
329209
/**
330210
* Returns the absolute path to the project.
331211
*
@@ -335,21 +215,4 @@ private function getProjectPath(): string
335215
{
336216
return dirname(__FILE__);
337217
}
338-
339-
340-
/**
341-
* @return string
342-
*/
343-
private function getSiteName(): string
344-
{
345-
return getenv('TERMINUS_SITE') ?? 'ci-terminus-composer';
346-
}
347-
348-
/**
349-
* @return string
350-
*/
351-
private function getSiteEnv(): string
352-
{
353-
return getenv('TERMINUS_ENV') ?? 'dev';
354-
}
355218
}

bin/terminus

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
// Unset memory limit
1313
ini_set('memory_limit', -1);
1414

15-
if (version_compare(PHP_VERSION, '7.4.0', '<') === true) {
15+
if (version_compare(PHP_VERSION, '8.2.0', '<') === true) {
1616
fwrite(STDERR, "\n");
1717
fwrite(STDERR, 'Sorry, your PHP version (' . PHP_VERSION . ') is no longer supported.' . "\n");
18-
fwrite(STDERR, 'Upgrade to PHP 7.4 or newer to use Terminus 3. For PHP versions prior to 7.4, downgrade to Terminus 2.x.' . "\n\n");
18+
fwrite(STDERR, 'Upgrade to PHP 8.2 or newer to use Terminus 4. For PHP versions prior to 8.2, downgrade to Terminus 3.x.' . "\n\n");
1919
fwrite(STDERR, 'For more information, see https://pantheon.io/docs/terminus/updates#php-version-compatibility-matrix' . "\n\n");
2020
exit(1);
2121
}
2222

23-
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.4.0', '>=') === true) {
23+
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.5.0', '>=') === true) {
2424
fwrite(STDERR, "\n");
25-
fwrite(STDERR, 'PHP 8.4+ is not supported by this version of Terminus.' . "\n");
25+
fwrite(STDERR, 'PHP 8.5+ is not supported by this version of Terminus.' . "\n");
2626
fwrite(STDERR, 'Check for new versions at https://github.com/pantheon-systems/terminus/releases' . "\n");
2727
fwrite(STDERR, "\n");
2828
fwrite(STDERR, 'Set environment variable TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP to try continuing anyway.' . "\n");
@@ -32,7 +32,7 @@ if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSI
3232

3333
// This variable is automatically managed via updateDependenciesversion() in /RoboFile.php,
3434
// which is run after every call to composer update.
35-
$terminusPluginsDependenciesVersion = 'a6b56bb299';
35+
$terminusPluginsDependenciesVersion = 'b17f504e52';
3636

3737
// Cannot use $_SERVER superglobal since that's empty during phpunit testing
3838
// getenv('HOME') isn't set on Windows and generates a Notice.

0 commit comments

Comments
 (0)