Files
ljwx-harbor/harbor/list-repositories.sh
T
gaoandClaude 745aa30d5f feat: 完善云原生 DevOps 工具链和 Harbor 集成
- 更新 Harbor 配置和部署脚本
- 添加 Gitea runner 配置和相关文件
- 完善 Tekton 流水线配置
- 添加 Harbor 镜像推送和管理脚本
- 修复 CI/CD 部署步骤和配置

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 14:57:30 +08:00

34 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# 直接从存储目录列出所有仓库的脚本
set -e
echo "=== Harbor Library 项目中的所有仓库 ==="
echo "从存储目录直接读取:"
echo ""
# 列出存储目录中的所有仓库
docker exec registry find /storage/docker/registry/v2/repositories/library/ -maxdepth 1 -type d -not -path "/storage/docker/registry/v2/repositories/library/" | sed 's|^.*/||' | sort
echo ""
echo "=== 从数据库读取的仓库列表 ==="
echo ""
# 从数据库读取仓库
docker exec harbor-db psql -U postgres -d registry -c "SELECT name FROM repository WHERE project_id = 1 ORDER BY name;" -t | sed 's/^ *//;s/ *$//' | grep -v '^$' | grep -v 'name'
echo ""
echo "=== 推送验证测试 ==="
echo ""
# 验证几个关键仓库是否可以正常拉取
IMAGES=("nginx:1.24.0" "redis:7.0.11" "alpine:latest" "mysql:latest" "hello-world:latest")
for image in "${IMAGES[@]}"; do
echo -n "测试拉取 localhost:8443/library/$image ... "
if docker manifest inspect "localhost:8443/library/$image" >/dev/null 2>&1; then
echo "✓ 可用"
else
echo "✗ 不可用"
fi
done