diff --git a/.woodpecker.yml b/.woodpecker.yml index 0687615..c88505e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,16 +2,38 @@ # Harbor registry: hub.peikarband.ir (مطابق با values-prd.yaml) steps: - # مرحله ساخت با Kaniko Executor (مستقیم - مطمئن‌تر از plugin) + # مرحله Clone (برای debug و مشاهده لاگ‌ها) + clone: + image: plugins/git + settings: + depth: 50 + when: + event: [push, tag, manual] + + # مرحله ساخت با Kaniko Executor build-and-push: image: gcr.io/kaniko-project/executor:latest secrets: - harbor_username - harbor_password + environment: + # استفاده از secrets به عنوان environment variables + HARBOR_USERNAME: + from_secret: harbor_username + HARBOR_PASSWORD: + from_secret: harbor_password commands: - # ساخت Docker config برای Harbor + # نمایش اطلاعات برای debug + - echo "Building for commit: ${CI_COMMIT_SHA}" + - echo "Working directory: $(pwd)" + - ls -la + # ساخت Docker config برای Harbor (با استفاده از base64 encoding) - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"hub.peikarband.ir\":{\"username\":\"$${HARBOR_USERNAME}\",\"password\":\"$${HARBOR_PASSWORD}\"}}}" > /kaniko/.docker/config.json + - | + AUTH=$(echo -n "${HARBOR_USERNAME}:${HARBOR_PASSWORD}" | base64 -w 0) + echo "{\"auths\":{\"hub.peikarband.ir\":{\"auth\":\"${AUTH}\"}}}" > /kaniko/.docker/config.json + # نمایش config (بدون password) + - cat /kaniko/.docker/config.json | sed 's/"auth":"[^"]*"/"auth":"***"/g' # Build و Push به Harbor - /kaniko/executor --dockerfile=Dockerfile @@ -21,6 +43,7 @@ steps: --insecure=false --skip-tls-verify=false --digest-file=/kaniko/digest-file + --verbosity=info when: event: [push, tag, manual]