Skip to content

Commit 6bc4b7f

Browse files
author
Jonathan Visser
committed
Satisfy prepare:ssh with a throwaway key in secretless build jobs
hypernode-deploy's prepare:ssh task hard-fails when the ssh-agent has no identities (it lists loaded keys unconditionally), so builds without SSH_PRIVATE_KEY cannot pass even though building needs no server access. Generate a key that grants access to nothing instead of reintroducing the real deploy key into jobs that run untrusted pull request code.
1 parent 7d3d079 commit 6bc4b7f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
run: |
3131
echo "DOCS_BASE_URL=https://docs.hypernode.com/" >> $GITHUB_ENV
3232
echo "DOCS_INDEX_FOLLOW=1" >> $GITHUB_ENV
33+
# The prepare:ssh task fails on an empty ssh-agent, but building needs no
34+
# server access, so satisfy it with a key that grants access to nothing.
35+
- name: Generate a throwaway SSH key for the build
36+
run: mkdir -p ~/.ssh && ssh-keygen -t ed25519 -N '' -q -f ~/.ssh/id_ed25519
3337
- run: hypernode-deploy build -vvv
3438
- name: archive production artifacts
3539
uses: actions/upload-artifact@v4

.github/workflows/pr-build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
fetch-depth: 0
1919
- name: Add repository to git safe directories
2020
run: git config --global --add safe.directory $GITHUB_WORKSPACE
21+
# The prepare:ssh task fails on an empty ssh-agent, but building needs no
22+
# server access, so satisfy it with a key that grants access to nothing.
23+
- name: Generate a throwaway SSH key for the build
24+
run: mkdir -p ~/.ssh && ssh-keygen -t ed25519 -N '' -q -f ~/.ssh/id_ed25519
2125
- run: hypernode-deploy build -vvv
2226
- name: archive build artifact
2327
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)