Compare commits

..
Author SHA1 Message Date
rock 4ed5c76865 fix: use env vars for docker registry credentials
CI / Test (pull_request) Successful in 2m5s
CI / Build & Push Image (pull_request) Skipped
2026-09-06 23:40:56 -07:00
rock ba86c3cedb fix: use env vars for docker registry credentials
CI / Test (pull_request) Successful in 2m21s
CI / Build & Push Image (pull_request) Skipped
2026-09-06 23:38:01 -07:00
rock c3f5f65540 fix: validate registry credentials before docker login
CI / Test (pull_request) Successful in 2m8s
CI / Build & Push Image (pull_request) Skipped
Problem: Registry login fails silently if secrets aren't configured
- Empty FORGEJO_REGISTRY_USER/TOKEN → docker login hangs/fails
- No clear error message about missing credentials

Solution: Add validation step that checks credentials exist
- Fails early with clear error if secrets missing
- Shows how to configure in repo settings
- Uses direct secret injection (not via env vars)
- Isolates docker config to /tmp/docker-config

Result: CI will fail fast with actionable error if credentials missing
2026-09-06 23:34:48 -07:00
rock 2bbcc6eef9 merge: fix CI workflow - add Node.js and docker.io installs (#17)
CI / Test (push) Successful in 2m23s
CI / Build & Push Image (push) Failing after 49s
Merge fix/memory-ci-nodejs-docker into main to enable CI triggers.

## Changes
- Add Node.js install before actions/checkout@v4
- Add docker.io install before docker login
- Add env vars (REGISTRY, REGISTRY_USER)
- Test job runs on all branches + PRs 
- Build-push job only runs on main push 

## Result
- PRs: CI runs tests (no registry push) 
- Main push: CI runs tests + builds + pushes to registry Reviewed-on: rock/poimen-memory#17

Co-authored-by: rock <[email protected]>
2026-09-07 06:24:18 +00:00
+9 -17
View File
@@ -49,35 +49,27 @@ jobs:
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Validate registry credentials
run: |
if [ -z "${{ secrets.FORGEJO_REGISTRY_USER }}" ] || [ -z "${{ secrets.FORGEJO_REGISTRY_TOKEN }}" ]; then
echo "❌ ERROR: Registry secrets not configured"
echo "Set FORGEJO_REGISTRY_USER and FORGEJO_REGISTRY_TOKEN in repo settings"
exit 1
fi
echo "✓ Registry credentials configured"
- name: Registry login
run: |
echo "${{ secrets.FORGEJO_REGISTRY_TOKEN }}" | docker login "${{ env.REGISTRY }}" \
--username "${{ secrets.FORGEJO_REGISTRY_USER }}" --password-stdin
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
--username "${REGISTRY_USER}" --password-stdin
env:
DOCKER_CONFIG: /tmp/docker-config
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Build Docker image
run: |
docker build --no-cache \
-t "${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}" \
-t "${{ env.IMAGE }}:latest" \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-t "${IMAGE}:latest" \
-f Dockerfile \
.
- name: Push Docker image
run: |
docker push "${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}"
docker push "${{ env.IMAGE }}:latest"
echo "✓ Image pushed: ${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:latest"
echo "✓ Image pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
- name: Prune unused images
run: docker image prune -a --force 2>&1 | tail -3 || true