Skip to content

Commit 3ae6c9e

Browse files
authored
#358: Prefer standard TERMINUS_MACHINE_TOKEN variable name for Pantheon tasks, actions and workflows (#1186)
1 parent fda2d0c commit 3ae6c9e

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

.github/workflows/TestPantheon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
3434
- uses: ./scaffold/github/actions/pantheon/setup-terminus
3535
with:
36-
pantheon-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
36+
terminus-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
3737

3838
- name: Get site Git URL and configure SSH host
3939
id: gitinfo

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ To enable deployment of Pantheon Review Apps (Multidev environments per pull req
729729
- `PANTHEON_CLONE_FROM` (optional) The environment to clone from when creating multidev sites. Defaults to 'live'
730730
- `PANTHEON_SKIP_WIPE_MULTIDEV` (optional) Set to 'true' to skip wiping the multidev environment on each push, preserving its database state. Defaults to 'false'
731731
- Add the following [secrets to your GitHub repository](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-development-environment-secrets-for-your-repository-or-organization#adding-secrets-for-a-repository):
732-
- `PANTHEON_TERMINUS_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token
732+
- `TERMINUS_MACHINE_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token (`PANTHEON_TERMINUS_TOKEN` is also accepted for backwards compatibility)
733733
- `SSH_PRIVATE_KEY` A private key of a user which can push to Pantheon
734734
- `SSH_KNOWN_HOSTS` The result of running `ssh-keyscan -H -p 2222 codeserver.dev.$PANTHEON_SITE_ID.drush.in`
735735
- `PANTHEON_REVIEW_USERNAME` (optional) A username for HTTP basic auth
@@ -885,7 +885,7 @@ To enable deployment of Pantheon Review Apps (Multidev environments per merge re
885885
- `PANTHEON_SITE_NAME` The canonical site name in Pantheon
886886
- `PANTHEON_SITE_ID` The Pantheon site UUID, used to construct the SSH remote URL
887887
- `PANTHEON_GIT_REMOTE` The Pantheon git remote URL e.g. `ssh://codeserver.dev.$PANTHEON_SITE_ID@codeserver.dev.$PANTHEON_SITE_ID.drush.in:2222/~/repository.git`
888-
- `PANTHEON_TERMINUS_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token (enable the _Mask variable_ checkbox)
888+
- `TERMINUS_MACHINE_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token (enable the _Mask variable_ checkbox). `PANTHEON_TERMINUS_TOKEN` is also accepted for backwards compatibility.
889889
- `SSH_PRIVATE_KEY` A private key of a user which can push to Pantheon (enable the _Mask variable_ checkbox)
890890
- `SSH_KNOWN_HOSTS` The result of running `ssh-keyscan -H -p 2222 codeserver.dev.$PANTHEON_SITE_ID.drush.in` (enable the _Mask variable_ checkbox)
891891
- `GIT_EMAIL` Email address to use for git commits
@@ -945,7 +945,7 @@ Additionally, Pantheon integration can be added:
945945
}
946946
```
947947

948-
This will install [Terminus](https://docs.pantheon.io/terminus) in the Tugboat environment. Add `PANTHEON_TOKEN` as a [Tugboat environment variable](https://docs.tugboatqa.com/setting-up-tugboat/select-repo-settings/#set-environment-variables) and set `PANTHEON_SITE_ID` in your `Taskfile.yml` vars. Then add a `sync:tugboat` task to fetch the database during Tugboat preview builds:
948+
This will install [Terminus](https://docs.pantheon.io/terminus) in the Tugboat environment. Add `TERMINUS_MACHINE_TOKEN` as a [Tugboat environment variable](https://docs.tugboatqa.com/setting-up-tugboat/select-repo-settings/#set-environment-variables) (`PANTHEON_TERMINUS_TOKEN` and `PANTHEON_TOKEN` are also accepted for backwards compatibility), and set `PANTHEON_SITE_ID` in your `Taskfile.yml` vars. Then add a `sync:tugboat` task to fetch the database during Tugboat preview builds:
949949

950950
```
951951
sync:tugboat:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 'Prepare Pantheon Environment'
22
description: 'Sets up Terminus and authorises with Pantheon'
33
inputs:
4-
pantheon-token:
4+
terminus-token:
55
description: "Pantheon Terminus Token"
66
required: true
77
terminus-plugins:
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- env:
14-
INPUT_PANTHEON_TOKEN: ${{ inputs.pantheon-token }}
14+
INPUT_TERMINUS_TOKEN: ${{ inputs.terminus-token }}
1515
INPUT_TERMINUS_PLUGINS: ${{ inputs.terminus-plugins }}
1616
run: |
1717
echo -e "Host *.drush.in\n StrictHostKeyChecking no\n HostkeyAlgorithms +ssh-rsa\n PubkeyAcceptedAlgorithms +ssh-rsa" >> ~/.ssh/config
@@ -20,5 +20,5 @@ runs:
2020
chmod +x ~/terminus/terminus
2121
ln -s ~/terminus/terminus /usr/local/bin/terminus
2222
echo "$INPUT_TERMINUS_PLUGINS" | while read -d, plugin || [[ -n $plugin ]]; do terminus self:plugin:install $plugin; done
23-
terminus auth:login --machine-token="$INPUT_PANTHEON_TOKEN"
23+
terminus auth:login --machine-token="$INPUT_TERMINUS_TOKEN"
2424
shell: bash

scaffold/github/workflows/PantheonReviewApps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
- uses: ./.github/actions/drainpipe/pantheon/setup-terminus
5454
with:
55-
pantheon-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
55+
terminus-token: ${{ secrets.TERMINUS_MACHINE_TOKEN || secrets.PANTHEON_TERMINUS_TOKEN }}
5656
terminus-plugins: ${{ vars.TERMINUS_PLUGINS || secrets.TERMINUS_PLUGINS }}
5757

5858
- uses: php-actions/composer@8a65f0d3c6a1d17ca4800491a40b5756a4c164f3 # v6.1.2
@@ -69,7 +69,7 @@ jobs:
6969
uses: ./.github/actions/drainpipe/pantheon/review
7070
with:
7171
github-token: ${{ secrets.GITHUB_TOKEN }}
72-
terminus-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
72+
terminus-token: ${{ secrets.TERMINUS_MACHINE_TOKEN || secrets.PANTHEON_TERMINUS_TOKEN }}
7373
commit-message: ${{ github.sha }}
7474
site-name: ${{ vars.PANTHEON_SITE_NAME || secrets.PANTHEON_SITE_NAME }}
7575
lock-username: ${{ secrets.PANTHEON_REVIEW_USERNAME }}

scaffold/github/workflows/PantheonReviewAppsDDEV.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
uses: ./.github/actions/drainpipe/pantheon/review
5353
with:
5454
github-token: ${{ secrets.GITHUB_TOKEN }}
55-
terminus-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
55+
terminus-token: ${{ secrets.TERMINUS_MACHINE_TOKEN || secrets.PANTHEON_TERMINUS_TOKEN }}
5656
commit-message: ${{ github.sha }}
5757
site-name: ${{ vars.PANTHEON_SITE_NAME || secrets.PANTHEON_SITE_NAME }}
5858
lock-username: ${{ secrets.PANTHEON_REVIEW_USERNAME }}

scaffold/gitlab/Pantheon.gitlab-ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,14 @@
88
- chmod +x ~/terminus/terminus
99
- ln -s ~/terminus/terminus /usr/local/bin/terminus
1010
- echo "$TERMINUS_PLUGINS" | while read -d, plugin || [[ -n $plugin ]]; do terminus self:plugin:install $plugin; done
11-
- terminus auth:login --machine-token="$PANTHEON_TERMINUS_TOKEN"
11+
- |
12+
if [ -n "$TERMINUS_MACHINE_TOKEN" ]; then
13+
_PANTHEON_AUTH_TOKEN="$TERMINUS_MACHINE_TOKEN"
14+
elif [ -n "$PANTHEON_TERMINUS_TOKEN" ]; then
15+
echo "WARNING: PANTHEON_TERMINUS_TOKEN is deprecated. Please use TERMINUS_MACHINE_TOKEN instead."
16+
_PANTHEON_AUTH_TOKEN="$PANTHEON_TERMINUS_TOKEN"
17+
else
18+
echo "ERROR: No Pantheon token found. Set TERMINUS_MACHINE_TOKEN as a CI/CD variable."
19+
exit 1
20+
fi
21+
terminus auth:login --machine-token="$_PANTHEON_AUTH_TOKEN"

tasks/pantheon.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ tasks:
55
desc: "Authenticates with Pantheon"
66
silent: true
77
cmds:
8-
- if [ -z "$PANTHEON_TOKEN" ]; then echo "❌ PANTHEON_TOKEN is not set. Add it to ~/.ddev/global_config.yaml (web-environment) or your project .env file."; exit 1; fi
9-
- echo "⚡ Authorizing with Pantheon..."
10-
- terminus auth:login --machine-token="$PANTHEON_TOKEN" >/dev/null 2>&1 || { echo "❌ Authentication failed. Check PANTHEON_TOKEN in ~/.ddev/global_config.yaml or your project .env file."; exit 1; }
11-
- echo "✅ Authentication successful."
8+
- |
9+
if [ -n "$TERMINUS_MACHINE_TOKEN" ]; then
10+
_PANTHEON_AUTH_TOKEN="$TERMINUS_MACHINE_TOKEN"
11+
elif [ -n "$PANTHEON_TERMINUS_TOKEN" ]; then
12+
echo "⚠️ PANTHEON_TERMINUS_TOKEN is deprecated. Please use TERMINUS_MACHINE_TOKEN instead."
13+
_PANTHEON_AUTH_TOKEN="$PANTHEON_TERMINUS_TOKEN"
14+
elif [ -n "$PANTHEON_TOKEN" ]; then
15+
echo "⚠️ PANTHEON_TOKEN is deprecated. Please use TERMINUS_MACHINE_TOKEN instead."
16+
_PANTHEON_AUTH_TOKEN="$PANTHEON_TOKEN"
17+
else
18+
echo "❌ No Pantheon token found. Set TERMINUS_MACHINE_TOKEN in ~/.ddev/global_config.yaml (web-environment) or your project .env file."
19+
exit 1
20+
fi
21+
echo "⚡ Authorizing with Pantheon..."
22+
terminus auth:login --machine-token="$_PANTHEON_AUTH_TOKEN" >/dev/null 2>&1 || { echo "❌ Authentication failed. Check your Pantheon token in ~/.ddev/global_config.yaml or your project .env file."; exit 1; }
23+
echo "✅ Authentication successful."
1224
1325
fetch-db:
1426
desc: "Fetches a database from Pantheon"

0 commit comments

Comments
 (0)