Added `-w 0` to base64 command for credientals produce a base64 value larger than 76 charters (#25)

If a username, and password that produces a base64 value larger than 76 characters, base64 will add \n to the output to wrap the text. The \n is then moved to the ~/.docker/config.json, that would break build image step producing the error of
```
WARNING: Error loading config file: /root/.docker/config.json: invalid character '\n' in string literal
```

Reviewed-on: https://gitea.com/gitea/test-env/pulls/25
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: James712346 <james712346@noreply.gitea.io>
Co-committed-by: James712346 <james712346@noreply.gitea.io>
This commit is contained in:
James712346 2023-05-03 22:23:00 +08:00 committed by techknowlogick
parent 9a7d3d6036
commit 7d38483860
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ jobs:
uses: https://github.com/docker/setup-buildx-action@v2
- name: login into docker hub
run: |
BASE64_AUTH=`echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64`
BASE64_AUTH=`echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64 -w 0`
mkdir -p ~/.docker
echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json
env: