diff --git a/.gitea/workflows/continuous_integration.yaml b/.gitea/workflows/continuous_integration.yaml index 471d424..703d936 100644 --- a/.gitea/workflows/continuous_integration.yaml +++ b/.gitea/workflows/continuous_integration.yaml @@ -508,6 +508,10 @@ jobs: # extra steps). A manual workflow_dispatch run only deploys to test when deploy_test is checked, # since a dispatch run is often just re-running CI/production, not a new test build (FR-03, D-01, # D-09). + # deploy_path / service_name / health_check_url come straight from the Gitea variables, NOT from the `config` job + # outputs: a job output whose value contains a secret value (here most likely the deploy account name inside the + # path) is dropped by the runner, so the reusable workflow received an empty deploy_path ("/releases"). The + # `config` outputs are still used for the artifact and environment names. deploy-test: needs: [publish-test, config] if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') @@ -516,9 +520,9 @@ jobs: with: artifact_name: ${{ needs.config.outputs.artifact_name_test }} environment: ${{ needs.config.outputs.deploy_environment_test }} - deploy_path: ${{ needs.config.outputs.deploy_path_test }} - service_name: ${{ needs.config.outputs.service_name_test }} - health_check_url: ${{ needs.config.outputs.health_check_url_test }} + deploy_path: ${{ vars.DEPLOY_PATH_TEST }} + service_name: ${{ vars.SERVICE_NAME_TEST }} + health_check_url: ${{ vars.HEALTH_CHECK_URL_TEST }} run_db_backup: false # Production deploy ONLY on an explicit workflow_dispatch run with deploy_production checked @@ -532,9 +536,9 @@ jobs: with: artifact_name: ${{ needs.config.outputs.artifact_name_production }} environment: ${{ needs.config.outputs.deploy_environment_production }} - deploy_path: ${{ needs.config.outputs.deploy_path_production }} - service_name: ${{ needs.config.outputs.service_name_production }} - health_check_url: ${{ needs.config.outputs.health_check_url_production }} + deploy_path: ${{ vars.DEPLOY_PATH_PRODUCTION }} + service_name: ${{ vars.SERVICE_NAME_PRODUCTION }} + health_check_url: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }} run_db_backup: true # ========================================================================================== diff --git a/.gitea/workflows/deploy-scp.yaml b/.gitea/workflows/deploy-scp.yaml index b39105b..2db2680 100644 --- a/.gitea/workflows/deploy-scp.yaml +++ b/.gitea/workflows/deploy-scp.yaml @@ -57,7 +57,15 @@ jobs: SSH_PORT: ${{ secrets.PI_MAIN_PORT }} SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }} SSH_KEY: ${{ secrets.PI_MAIN_SSH_KEY }} + IN_DEPLOY_PATH: ${{ inputs.deploy_path }} + IN_SERVICE_NAME: ${{ inputs.service_name }} + IN_HEALTH_URL: ${{ inputs.health_check_url }} run: | + # Inputs are not secret: print them so an empty one is visible, and stop before anything touches the host. + echo "Inputs: deploy_path='$IN_DEPLOY_PATH' service_name='$IN_SERVICE_NAME' health_check_url='$IN_HEALTH_URL'" + for v in IN_DEPLOY_PATH IN_SERVICE_NAME IN_HEALTH_URL; do + if [ -z "${!v}" ]; then echo "Input $v is empty; refusing to deploy."; exit 1; fi + done SUDO="" if [ "$(id -u)" != "0" ] && command -v sudo >/dev/null 2>&1; then SUDO="sudo"; fi if ! command -v sshpass >/dev/null 2>&1 || ! command -v ssh >/dev/null 2>&1 || ! command -v scp >/dev/null 2>&1; then