Fix SCP-deploy: geef secrets via env: door i.p.v. inline in het script
Continuous Integration / config (pull_request) Successful in 10s
Continuous Integration / prepare (pull_request) Successful in 1m27s
Continuous Integration / build-production (pull_request) Skipped
Continuous Integration / build (pull_request) Successful in 2m6s
Continuous Integration / test (pull_request) Successful in 1m58s
Continuous Integration / deploy-production (pull_request) Skipped
Deploy / deploy (pull_request) Successful in 35s
Continuous Integration / deploy-test (pull_request) Successful in 34s
Continuous Integration / config (pull_request) Successful in 10s
Continuous Integration / prepare (pull_request) Successful in 1m27s
Continuous Integration / build-production (pull_request) Skipped
Continuous Integration / build (pull_request) Successful in 2m6s
Continuous Integration / test (pull_request) Successful in 1m58s
Continuous Integration / deploy-production (pull_request) Skipped
Deploy / deploy (pull_request) Successful in 35s
Continuous Integration / deploy-test (pull_request) Successful in 34s
Gitea Actions plakt ${{ secrets.* }} als platte tekst in het run-script
vóórdat bash het uitvoert. Bevat het wachtwoord een shell-metateken
zoals '$', dan interpreteert bash dat alsnog, waardoor sshpass een
ander wachtwoord krijgt dan bedoeld ("Permission denied"). Via env:
en sshpass -e komt de waarde als kant-en-klare string binnen, zonder
die tweede interpretatieslag.
This commit is contained in:
@@ -37,10 +37,23 @@ jobs:
|
|||||||
# voor containeracties niet volledig ondersteunt. Een scp-commando
|
# voor containeracties niet volledig ondersteunt. Een scp-commando
|
||||||
# in een normale run-stap heeft die geneste container niet nodig.
|
# in een normale run-stap heeft die geneste container niet nodig.
|
||||||
- name: Upload dist to ${{ inputs.environment }} web server via SCP
|
- name: Upload dist to ${{ inputs.environment }} web server via SCP
|
||||||
|
env:
|
||||||
|
# Secrets via env: in plaats van rechtstreeks in het `run:`-script
|
||||||
|
# ge-interpoleerd: Gitea Actions plakt ${{ secrets.* }} als platte
|
||||||
|
# tekst in het script vóórdat bash het uitvoert. Staat er een
|
||||||
|
# shell-metateken in de waarde (zoals '$' of '`'), dan probeert
|
||||||
|
# bash dat alsnog te interpreteren, waardoor een ander wachtwoord
|
||||||
|
# bij sshpass terechtkomt dan verwacht ("Permission denied"). Via
|
||||||
|
# env: krijgt bash de waarde als kant-en-klare string doorgegeven,
|
||||||
|
# zonder die tweede interpretatieslag.
|
||||||
|
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }}
|
||||||
|
PI_MAIN_PORT: ${{ secrets.PI_MAIN_PORT }}
|
||||||
|
PI_MAIN_USERNAME: ${{ secrets.PI_MAIN_USERNAME }}
|
||||||
|
PI_MAIN_ADDRESS: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||||
run: |
|
run: |
|
||||||
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 }}" scp \
|
sshpass -e scp \
|
||||||
-P ${{ secrets.PI_MAIN_PORT }} \
|
-P "$PI_MAIN_PORT" \
|
||||||
-o StrictHostKeyChecking=no \
|
-o StrictHostKeyChecking=no \
|
||||||
-r ${{ inputs.artifact_name }}/* \
|
-r ${{ inputs.artifact_name }}/* \
|
||||||
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_ADDRESS }}:${{ inputs.deploy_path }}
|
"$PI_MAIN_USERNAME@$PI_MAIN_ADDRESS:${{ inputs.deploy_path }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user