@hed-hog/cli 0.0.64 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json
CHANGED
|
@@ -252,9 +252,10 @@ jobs:
|
|
|
252
252
|
|
|
253
253
|
for ENV_VAR in "${REQUIRED_ENVS[@]}"; do
|
|
254
254
|
# Check if env var is set and not empty in the container
|
|
255
|
-
|
|
255
|
+
# Use 'printenv' to safely retrieve the environment variable value
|
|
256
|
+
ENV_VALUE=$(kubectl exec "$POD_NAME" -n ${{ env.NAMESPACE }} -- printenv "$ENV_VAR" 2>/dev/null || echo "")
|
|
256
257
|
|
|
257
|
-
if [ -z "$ENV_VALUE" ]
|
|
258
|
+
if [ -z "$ENV_VALUE" ]; then
|
|
258
259
|
echo "✗ FAIL: $ENV_VAR is not set or empty in the container"
|
|
259
260
|
VERIFICATION_FAILED=1
|
|
260
261
|
else
|
|
@@ -273,6 +274,51 @@ jobs:
|
|
|
273
274
|
fi
|
|
274
275
|
|
|
275
276
|
echo "✓ All environment variables verified successfully in the container"
|
|
277
|
+
- name: Cleanup old registry manifests (API)
|
|
278
|
+
run: |
|
|
279
|
+
set -eu
|
|
280
|
+
REGISTRY_NAME="${REGISTRY##*/}"
|
|
281
|
+
|
|
282
|
+
cleanup_repository() {
|
|
283
|
+
REPOSITORY="$1"
|
|
284
|
+
|
|
285
|
+
echo "Inspecting repository ${REPOSITORY} in registry ${REGISTRY_NAME}"
|
|
286
|
+
|
|
287
|
+
TAG_ROWS="$(doctl registry repository list-tags "${REPOSITORY}" --registry "${REGISTRY_NAME}" --format Tag,ManifestDigest --no-header || true)"
|
|
288
|
+
|
|
289
|
+
if [ -z "${TAG_ROWS}" ]; then
|
|
290
|
+
echo "No tags found for ${REPOSITORY}; skipping cleanup."
|
|
291
|
+
return 0
|
|
292
|
+
fi
|
|
293
|
+
|
|
294
|
+
CURRENT_DIGEST="$(printf '%s\n' "${TAG_ROWS}" | awk -v target="${{ github.sha }}" '$1 == target { print $2; exit }')"
|
|
295
|
+
|
|
296
|
+
if [ -z "${CURRENT_DIGEST}" ]; then
|
|
297
|
+
echo "::error::Unable to determine current manifest digest for ${REPOSITORY}:${{ github.sha }}"
|
|
298
|
+
exit 1
|
|
299
|
+
fi
|
|
300
|
+
|
|
301
|
+
OLD_DIGESTS="$(printf '%s\n' "${TAG_ROWS}" | awk -v keep="${CURRENT_DIGEST}" 'NF >= 2 && $2 != keep { print $2 }' | sort -u)"
|
|
302
|
+
|
|
303
|
+
if [ -z "${OLD_DIGESTS}" ]; then
|
|
304
|
+
echo "No old manifests to delete for ${REPOSITORY}."
|
|
305
|
+
return 0
|
|
306
|
+
fi
|
|
307
|
+
|
|
308
|
+
echo "Deleting old manifests from ${REPOSITORY}:"
|
|
309
|
+
printf '%s\n' "${OLD_DIGESTS}"
|
|
310
|
+
|
|
311
|
+
printf '%s\n' "${OLD_DIGESTS}" | while IFS= read -r DIGEST; do
|
|
312
|
+
if [ -z "${DIGEST}" ]; then
|
|
313
|
+
continue
|
|
314
|
+
fi
|
|
315
|
+
|
|
316
|
+
doctl registry repository delete-manifest "${REPOSITORY}" "${DIGEST}" --registry "${REGISTRY_NAME}" --force
|
|
317
|
+
done
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
cleanup_repository "<%= config.appName %>-api"
|
|
321
|
+
cleanup_repository "<%= config.appName %>-api-migrate"
|
|
276
322
|
<% } %>
|
|
277
323
|
<% if ((config.apps || []).includes('admin')) { %>
|
|
278
324
|
deploy-admin:
|
|
@@ -313,11 +359,54 @@ jobs:
|
|
|
313
359
|
docker pull hello-world
|
|
314
360
|
docker tag hello-world ${{ env.REGISTRY }}/ci-auth-probe-admin:${{ github.run_id }}
|
|
315
361
|
docker push ${{ env.REGISTRY }}/ci-auth-probe-admin:${{ github.run_id }}
|
|
362
|
+
- name: Validate admin API URLs
|
|
363
|
+
run: |
|
|
364
|
+
set -eu
|
|
365
|
+
|
|
366
|
+
if [ -z "${{ env.ADMIN_API_URL }}" ]; then
|
|
367
|
+
echo "::error::ADMIN_API_URL is empty. Set it in workflow env before building admin image."
|
|
368
|
+
exit 1
|
|
369
|
+
fi
|
|
370
|
+
|
|
371
|
+
if [ -z "${{ env.ADMIN_API_BASE_URL }}" ]; then
|
|
372
|
+
echo "::error::ADMIN_API_BASE_URL is empty. Set it in workflow env before building admin image."
|
|
373
|
+
exit 1
|
|
374
|
+
fi
|
|
375
|
+
|
|
376
|
+
if [ -z "${{ env.ADMIN_INTERNAL_API_URL }}" ]; then
|
|
377
|
+
echo "::error::ADMIN_INTERNAL_API_URL is empty. Set it in workflow env before building admin image."
|
|
378
|
+
exit 1
|
|
379
|
+
fi
|
|
380
|
+
|
|
381
|
+
case "${{ env.ADMIN_API_URL }}" in
|
|
382
|
+
http://*|https://*) ;;
|
|
383
|
+
*)
|
|
384
|
+
echo "::error::ADMIN_API_URL must be an absolute URL (http/https). Current value: ${{ env.ADMIN_API_URL }}"
|
|
385
|
+
exit 1
|
|
386
|
+
;;
|
|
387
|
+
esac
|
|
388
|
+
|
|
389
|
+
case "${{ env.ADMIN_API_BASE_URL }}" in
|
|
390
|
+
http://*|https://*) ;;
|
|
391
|
+
*)
|
|
392
|
+
echo "::error::ADMIN_API_BASE_URL must be an absolute URL (http/https). Current value: ${{ env.ADMIN_API_BASE_URL }}"
|
|
393
|
+
exit 1
|
|
394
|
+
;;
|
|
395
|
+
esac
|
|
396
|
+
|
|
397
|
+
case "${{ env.ADMIN_INTERNAL_API_URL }}" in
|
|
398
|
+
http://*|https://*) ;;
|
|
399
|
+
*)
|
|
400
|
+
echo "::error::ADMIN_INTERNAL_API_URL must be an absolute URL (http/https). Current value: ${{ env.ADMIN_INTERNAL_API_URL }}"
|
|
401
|
+
exit 1
|
|
402
|
+
;;
|
|
403
|
+
esac
|
|
316
404
|
- name: Build Docker image
|
|
317
405
|
run: |
|
|
318
|
-
docker build -t ${{ env.REGISTRY }}
|
|
406
|
+
docker build -t ${{ env.REGISTRY }}/hub-admin:${{ github.sha }} \
|
|
319
407
|
--build-arg NEXT_PUBLIC_API_BASE_URL=${{ env.ADMIN_API_BASE_URL }} \
|
|
320
408
|
--build-arg NEXT_PUBLIC_API_URL=${{ env.ADMIN_API_URL }} \
|
|
409
|
+
--build-arg INTERNAL_API_URL=${{ env.ADMIN_INTERNAL_API_URL }} \
|
|
321
410
|
-f apps/admin/Dockerfile .
|
|
322
411
|
- name: Push Docker image (sha)
|
|
323
412
|
run: |
|
|
@@ -360,4 +449,43 @@ jobs:
|
|
|
360
449
|
kubectl logs -l app=<%= config.appName %>-admin -n ${{ env.NAMESPACE }} --tail=50 --previous 2>/dev/null || true
|
|
361
450
|
exit 1
|
|
362
451
|
)
|
|
452
|
+
- name: Cleanup old registry manifests (ADMIN)
|
|
453
|
+
run: |
|
|
454
|
+
set -eu
|
|
455
|
+
REGISTRY_NAME="${REGISTRY##*/}"
|
|
456
|
+
REPOSITORY="<%= config.appName %>-admin"
|
|
457
|
+
|
|
458
|
+
echo "Inspecting repository ${REPOSITORY} in registry ${REGISTRY_NAME}"
|
|
459
|
+
|
|
460
|
+
TAG_ROWS="$(doctl registry repository list-tags "${REPOSITORY}" --registry "${REGISTRY_NAME}" --format Tag,ManifestDigest --no-header || true)"
|
|
461
|
+
|
|
462
|
+
if [ -z "${TAG_ROWS}" ]; then
|
|
463
|
+
echo "No tags found for ${REPOSITORY}; skipping cleanup."
|
|
464
|
+
exit 0
|
|
465
|
+
fi
|
|
466
|
+
|
|
467
|
+
CURRENT_DIGEST="$(printf '%s\n' "${TAG_ROWS}" | awk -v target="${{ github.sha }}" '$1 == target { print $2; exit }')"
|
|
468
|
+
|
|
469
|
+
if [ -z "${CURRENT_DIGEST}" ]; then
|
|
470
|
+
echo "::error::Unable to determine current manifest digest for ${REPOSITORY}:${{ github.sha }}"
|
|
471
|
+
exit 1
|
|
472
|
+
fi
|
|
473
|
+
|
|
474
|
+
OLD_DIGESTS="$(printf '%s\n' "${TAG_ROWS}" | awk -v keep="${CURRENT_DIGEST}" 'NF >= 2 && $2 != keep { print $2 }' | sort -u)"
|
|
475
|
+
|
|
476
|
+
if [ -z "${OLD_DIGESTS}" ]; then
|
|
477
|
+
echo "No old manifests to delete for ${REPOSITORY}."
|
|
478
|
+
exit 0
|
|
479
|
+
fi
|
|
480
|
+
|
|
481
|
+
echo "Deleting old manifests from ${REPOSITORY}:"
|
|
482
|
+
printf '%s\n' "${OLD_DIGESTS}"
|
|
483
|
+
|
|
484
|
+
printf '%s\n' "${OLD_DIGESTS}" | while IFS= read -r DIGEST; do
|
|
485
|
+
if [ -z "${DIGEST}" ]; then
|
|
486
|
+
continue
|
|
487
|
+
fi
|
|
488
|
+
|
|
489
|
+
doctl registry repository delete-manifest "${REPOSITORY}" "${DIGEST}" --registry "${REGISTRY_NAME}" --force
|
|
490
|
+
done
|
|
363
491
|
<% } %>
|