feat(secrets): integrate Infisical Universal Auth into Gitea Actions workflows
- Configure Infisical CLI authentication via INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET - Fetch runner SSH keys and state tokens dynamically from /ci-cd - Fetch Proxmox target endpoints and tokens dynamically from /proxmox/<TARGET> - Remove plaintext secrets from Ansible core_secrets defaults - Clean up obsolete files and add --remove-orphans to docker compose invocations
This commit is contained in:
1 parent
efc23dfac2
commit
d2888c1149
14 files changed
+124
-70
No files matched your search
@@ -18,11 +18,41 @@ jobs:
|
||||
steps:
|
||||
- name: Деплой core-secrets через Ansible
|
||||
env:
|
||||
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
|
||||
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
# Направляем домены на актуальный шлюз Traefik (core-net 192.168.1.104)
|
||||
for domain in gitea.gunihome.ru infisical.gunihome.ru; do
|
||||
if ! grep -q "${domain}" /etc/hosts; then
|
||||
echo "192.168.1.104 ${domain}" >> /etc/hosts
|
||||
fi
|
||||
done
|
||||
|
||||
# Авторизация в Infisical
|
||||
export INFISICAL_PROJECT_ID="806e7f09-5838-492a-946b-2d69b96876ab"
|
||||
export INFISICAL_DOMAIN="https://infisical.gunihome.ru/api"
|
||||
|
||||
infisical login \
|
||||
--domain="${INFISICAL_DOMAIN}" \
|
||||
--method=universal-auth \
|
||||
--client-id="${INFISICAL_CLIENT_ID}" \
|
||||
--client-secret="${INFISICAL_CLIENT_SECRET}" \
|
||||
--silent
|
||||
|
||||
# Подтягиваем SSH-ключ раннера из /ci-cd
|
||||
eval "$(infisical export --domain="${INFISICAL_DOMAIN}" --env=prod --projectId="${INFISICAL_PROJECT_ID}" --path="/ci-cd" --format=dotenv-export --silent)"
|
||||
|
||||
# Подтягиваем ключи infisical из /services/infisical
|
||||
eval "$(infisical export --domain="${INFISICAL_DOMAIN}" --env=prod --projectId="${INFISICAL_PROJECT_ID}" --path="/services/infisical" --format=dotenv-export --silent)"
|
||||
|
||||
export INFISICAL_POSTGRES_PASSWORD="${POSTGRES_PASSWORD}"
|
||||
export INFISICAL_ENCRYPTION_KEY="${ENCRYPTION_KEY}"
|
||||
export INFISICAL_AUTH_SECRET="${AUTH_SECRET}"
|
||||
|
||||
if [ -z "${RUNNER_SSH_KEY:-}" ]; then
|
||||
echo "В секретах Gitea отсутствует RUNNER_SSH_KEY" >&2
|
||||
echo "В Infisical (/ci-cd) отсутствует RUNNER_SSH_KEY" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user