fix: 使用顶层 secret 方式导入配置项,规避 podman 环境变量引入问题
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-12-26 16:58:07 +08:00
parent 95b65ec44f
commit 8a4643a7f1
+11 -7
View File
@@ -31,21 +31,25 @@ steps:
path: /run/podman/podman.sock
- name: containers-config
path: /etc/containers
environment:
REGISTRY_USER:
from_secret: swr_username
REGISTRY_PASSWORD:
from_secret: swr_password
secrets:
- source: swr_username
target: swr_username
- source: swr_password
target: swr_password
commands:
- |
REGISTRY_USER=$(cat /run/secrets/swr_username)
REGISTRY_PASSWORD=$(cat /run/secrets/swr_password)
REGISTRY_SERVER="swr.cn-north-4.myhuaweicloud.com"
echo "Logging into registry..."
# 调试:打印所有关键变量
echo "=== Debug Variables ==="
echo "REGISTRY_SERVER: swr.cn-north-4.myhuaweicloud.com"
echo "REGISTRY_SERVER: $REGISTRY_SERVER"
echo "REGISTRY_USER: ${REGISTRY_USER:-empty}"
echo "REGISTRY_PASSWORD: ${REGISTRY_PASSWORD:-empty}"
echo "========================"
podman login "swr.cn-north-4.myhuaweicloud.com" -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" || {
podman login "$REGISTRY_SERVER" -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" || {
echo "Registry login failed!"
exit 1
}