ci: pass the registry password on stdin, fail on a failed push
Build docker image and push to registry.bitdeals.org / main-build-job (push) Successful in 1m1s

A password in argv is world-readable through /proc/PID/cmdline while the
command runs; docker warns about it for that reason. The two pushes are joined
with && so the step's outcome is explicit rather than resting on whatever -e
flag the runner's shell happens to carry.
This commit is contained in:
bitdeals
2026-08-07 13:39:55 +00:00
parent 55083856c1
commit 9dfa45f901
+2 -2
View File
@@ -31,9 +31,9 @@ jobs:
--tag "${REGISTRY}/${REPOSITORY##*/}:latest"
- name: Docker login
run: |
docker login --username "$USER" --password "$PASS" "$REGISTRY"
echo "$PASS" | docker login --username "$USER" --password-stdin "$REGISTRY"
- name: Push images to registry
run: |
docker push "${REGISTRY}/${REPOSITORY##*/}:${VERSION}.${COMMIT::7}" ; \
docker push "${REGISTRY}/${REPOSITORY##*/}:${VERSION}.${COMMIT::7}" && \
docker push "${REGISTRY}/${REPOSITORY##*/}:latest"