Routes PI_MAIN_* secrets through env vars instead of inline interpolation
Continuous Integration / config (pull_request) Successful in 9s
Continuous Integration / backend-build (pull_request) Successful in 4m57s
Continuous Integration / vulnerability-scan (pull_request) Successful in 4m21s
Continuous Integration / frontend-prepare (pull_request) Successful in 1m28s
Continuous Integration / backend-test (pull_request) Successful in 5m3s
Continuous Integration / frontend-build (pull_request) Successful in 2m10s
Continuous Integration / frontend-test (pull_request) Successful in 4m42s
Continuous Integration / frontend-lint (pull_request) Successful in 1m56s
Continuous Integration / publish-production (pull_request) Skipped
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / publish-test (pull_request) Successful in 6m30s
Deploy (SCP) / deploy (pull_request) Failing after 57s
Continuous Integration / deploy-test (pull_request) Failing after 58s

Every ssh/scp step interpolated ${{ secrets.PI_MAIN_PASSWORD }} and
${{ secrets.PI_MAIN_USERNAME }} directly into the run: shell text.
Gitea/GitHub Actions substitutes that as literal text before bash ever
sees it, so any shell-metacharacter in the password ($, `, ", \) gets
re-interpreted by bash instead of passed through - silently changing
what sshpass actually receives. This plausibly explains a persistent
"Permission denied" even after the username and password length were
both confirmed correct via the debug step (which used env: and so
never hit this).

All five steps now receive SSH_USER/SSH_PASS/SSH_PORT/SSH_HOST via
env:, which bash treats as opaque values with no re-parsing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FffvxxJp5wG34Ru48GBig
This commit is contained in:
2026-07-29 20:42:57 +02:00
co-authored by Claude Sonnet 5
parent 3776c0f27b
commit 51488d6d94
+43 -18
View File
@@ -76,13 +76,18 @@ jobs:
# literal, unresolved `${{ inputs.environment }}` text in the log. # literal, unresolved `${{ inputs.environment }}` text in the log.
- name: Back up database - name: Back up database
if: ${{ inputs.run_db_backup }} if: ${{ inputs.run_db_backup }}
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: | run: |
echo "Environment: ${{ inputs.environment }}" echo "Environment: ${{ inputs.environment }}"
sudo apt-get update && sudo apt-get install -y sshpass sudo apt-get update && sudo apt-get install -y sshpass
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" ssh \ sshpass -p "$SSH_PASS" ssh \
-p ${{ secrets.PI_MAIN_PORT }} \ -p "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }} \ "$SSH_USER@$SSH_HOST" \
"bash ~/scripts/backup-slpsoftware-db.sh ${{ inputs.environment }}" "bash ~/scripts/backup-slpsoftware-db.sh ${{ inputs.environment }}"
# Uploads the published output to a fresh, timestamped release directory rather than # Uploads the published output to a fresh, timestamped release directory rather than
@@ -95,20 +100,25 @@ jobs:
# actions rely on (D-05). A plain scp command needs no nested container. # actions rely on (D-05). A plain scp command needs no nested container.
# Same Gitea Actions limitation as the step above — static name, value logged via echo instead. # Same Gitea Actions limitation as the step above — static name, value logged via echo instead.
- name: Upload release - name: Upload release
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: | run: |
echo "Environment: ${{ inputs.environment }}, transport: ${{ inputs.transport }}" echo "Environment: ${{ inputs.environment }}, transport: ${{ inputs.transport }}"
sudo apt-get update && sudo apt-get install -y sshpass sudo apt-get update && sudo apt-get install -y sshpass
RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}" RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}"
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" ssh \ sshpass -p "$SSH_PASS" ssh \
-p ${{ secrets.PI_MAIN_PORT }} \ -p "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }} \ "$SSH_USER@$SSH_HOST" \
"mkdir -p $RELEASE_DIR" "mkdir -p $RELEASE_DIR"
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" scp \ sshpass -p "$SSH_PASS" scp \
-P ${{ secrets.PI_MAIN_PORT }} \ -P "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
-r ${{ inputs.artifact_name }}/* \ -r ${{ inputs.artifact_name }}/* \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }}:"$RELEASE_DIR"/ "$SSH_USER@$SSH_HOST:$RELEASE_DIR/"
# The customer's public website (wwwroot/web) must survive every CMS deploy (FR-08, ASM-01). # The customer's public website (wwwroot/web) must survive every CMS deploy (FR-08, ASM-01).
# It lives outside the swapped release directory in a persistent shared/ folder, and is # It lives outside the swapped release directory in a persistent shared/ folder, and is
@@ -118,12 +128,17 @@ jobs:
# containing only the placeholder page) is removed before the symlink is created, so it never # containing only the placeholder page) is removed before the symlink is created, so it never
# shadows the persistent content. # shadows the persistent content.
- name: Link persistent website content - name: Link persistent website content
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: | run: |
RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}" RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}"
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" ssh \ sshpass -p "$SSH_PASS" ssh \
-p ${{ secrets.PI_MAIN_PORT }} \ -p "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }} \ "$SSH_USER@$SSH_HOST" \
"mkdir -p ${{ inputs.deploy_path }}/shared/wwwroot-web && \ "mkdir -p ${{ inputs.deploy_path }}/shared/wwwroot-web && \
rm -rf $RELEASE_DIR/wwwroot/web && \ rm -rf $RELEASE_DIR/wwwroot/web && \
ln -s ../../../shared/wwwroot-web $RELEASE_DIR/wwwroot/web" ln -s ../../../shared/wwwroot-web $RELEASE_DIR/wwwroot/web"
@@ -133,12 +148,17 @@ jobs:
# directory. The process is then restarted so it picks up the new assemblies — a running .NET # directory. The process is then restarted so it picks up the new assemblies — a running .NET
# process holds on to the ones it already loaded. # process holds on to the ones it already loaded.
- name: Switch current release and restart service - name: Switch current release and restart service
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: | run: |
RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}" RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}"
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" ssh \ sshpass -p "$SSH_PASS" ssh \
-p ${{ secrets.PI_MAIN_PORT }} \ -p "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }} \ "$SSH_USER@$SSH_HOST" \
"ln -sfn $RELEASE_DIR ${{ inputs.deploy_path }}/current && \ "ln -sfn $RELEASE_DIR ${{ inputs.deploy_path }}/current && \
systemctl --user restart ${{ inputs.service_name }}" systemctl --user restart ${{ inputs.service_name }}"
@@ -163,9 +183,14 @@ jobs:
# a re-point-and-restart away without rebuilding. Only runs after a passing health check — # a re-point-and-restart away without rebuilding. Only runs after a passing health check —
# pruning after a failed check could leave the only other release as the sole survivor. # pruning after a failed check could leave the only other release as the sole survivor.
- name: Prune old releases - name: Prune old releases
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: | run: |
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" ssh \ sshpass -p "$SSH_PASS" ssh \
-p ${{ secrets.PI_MAIN_PORT }} \ -p "$SSH_PORT" \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }} \ "$SSH_USER@$SSH_HOST" \
"cd ${{ inputs.deploy_path }}/releases && ls -1t | tail -n +3 | xargs -r rm -rf" "cd ${{ inputs.deploy_path }}/releases && ls -1t | tail -n +3 | xargs -r rm -rf"