ci: stop Drone from emptying SSH/registry secrets
continuous-integration/drone/push Build is failing

${SSH_USER} and friends are pre-expanded before secrets exist; escape as
$$ so OpenSSH gets the real from_secret env values.
This commit is contained in:
miczek committed 2026-10-15 04:59:49 +03:00
1 parent 4a74f74de0
commit add02543fb
1 file changed
+5 -3
+5 -3
View File
@@ -125,13 +125,15 @@ steps:
- apk add --no-cache openssh-client - apk add --no-cache openssh-client
- mkdir -p /root/.ssh && chmod 700 /root/.ssh - mkdir -p /root/.ssh && chmod 700 /root/.ssh
- printenv SSH_KEY > /root/.ssh/id_ed25519 && chmod 600 /root/.ssh/id_ed25519 - printenv SSH_KEY > /root/.ssh/id_ed25519 && chmod 600 /root/.ssh/id_ed25519
# Drone pre-expands ${VAR} (empty for secrets). Use $VAR / $$ so the shell
# reads the from_secret environment at runtime.
- | - |
ssh -i /root/.ssh/id_ed25519 \ ssh -i /root/.ssh/id_ed25519 \
-p "${SSH_PORT:-22}" \ -p "$${SSH_PORT:-22}" \
-o StrictHostKeyChecking=accept-new \ -o StrictHostKeyChecking=accept-new \
-o BatchMode=yes \ -o BatchMode=yes \
"${SSH_USER}@${SSH_HOST}" \ "$${SSH_USER}@$${SSH_HOST}" \
"export REGISTRY_USERNAME='${REGISTRY_USERNAME}' REGISTRY_PASSWORD='${REGISTRY_PASSWORD}'; bash -s" <<'EOS' "export REGISTRY_USERNAME='$${REGISTRY_USERNAME}' REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'; bash -s" <<'EOS'
set -euo pipefail set -euo pipefail
echo "${REGISTRY_PASSWORD}" | docker login registry.zea.lt -u "${REGISTRY_USERNAME}" --password-stdin echo "${REGISTRY_PASSWORD}" | docker login registry.zea.lt -u "${REGISTRY_USERNAME}" --password-stdin
cd /home/miczek/homelab/tracker cd /home/miczek/homelab/tracker