Commit a01d56e
committed
fix: preserve
When a serverless k8s (Harbor-backed) org runs through the legacy
`serverless_prod_deploy` / `serverless_branch_deploy` flow, the docker
login step fails with `401 unauthorized`. Two layers of bash variable
expansion eat the `$<project>` substring of the Harbor robot username
`robot$<project>+push`:
1. `src/registry_info.sh` ran `echo $REGISTRY_INFO > registry_info.env`
(unquoted) followed by `source registry_info.env`. Both re-expand
`$<project>` (an unset shell variable) to empty before the value
reached `$GITHUB_ENV`. Parse KEY=VALUE pairs via `read -r` instead so
the literal `$` survives.
2. The `Login to ECR` step in both deploy action YAMLs interpolated the
username via `${{ env.AWS_ECR_USERNAME }}` template substitution,
which pastes the value into the bash script *before* bash runs.
Switch to bash env-var access (`"$AWS_ECR_USERNAME"`) so the value
is read verbatim at run time, no recursive expansion.
ECR ("AWS" username, no `$`) is unaffected. Tested on a real prod
serverless v2 org by pinning a downstream workflow to this fix branch
and running both branch and prod deploys end to end.$ in Harbor robot username through registry-info + docker login1 parent 4b80945 commit a01d56e
3 files changed
Lines changed: 29 additions & 4 deletions
File tree
- actions
- serverless_branch_deploy
- serverless_prod_deploy
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
| |||
0 commit comments