mirror of
https://github.com/langgenius/dify-ee-helm-chart-values-generator.git
synced 2026-07-01 20:14:02 -04:00
d06ab44e52
* chore: 升级 tj-actions/changed-files 到 v46.0.1 * Add feature-based architecture for version-specific config Introduces a feature registry and auto-discovery system under modules/features/ to manage version-specific configuration logic. Adds base classes and decorators for feature registration, semantic version comparison, and applies features in global, infrastructure, plugins, and services modules. Implements features for trigger worker, plugin metrics, and external Prometheus (3.7.0+). Updates i18n translations and documentation to reflect the new architecture and configuration options. Includes tests for feature registration, version parsing, and applicability. * Add Docker registry secret generator and secret utils Added generate-image-repo-secret.sh for interactively creating Kubernetes imagePullSecret for private Docker registries. Updated .gitignore to better exclude sensitive files. Added utils/secrets.py for secret key generation. Updated README files with instructions for using the new secret generator script. * ci: add unit tests and module validation - Add test job to validate all Python module imports - Add feature tests, services tests, and S3 config tests - Add shell script validation with shellcheck - Update actions to v4/v5 versions - Add CI integration test plan documentation * ci: skip interactive tests in CI environment test_services.py and test_s3_config.py require interactive input, skip them until --ci mode is implemented * chore: add PR template * feat: add --ci non-interactive mode for CI testing - Add set_ci_mode() and is_ci_mode() to config.py - Add --ci flag to generate-values-prd.py - Update utils/prompts.py to return defaults in CI mode - Update i18n/language.py to use English in CI mode - Update utils/downloader.py to use latest version in CI mode - Update version_manager.py to avoid variable shadowing - Enable CI mode in test files for non-interactive testing
64 lines
1.6 KiB
Bash
Executable File
64 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "=========================================="
|
|
echo "Docker Registry Secret Generator"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# 交互式获取用户名
|
|
read -p "请输入 Docker Registry 用户名: " USERNAME
|
|
if [ -z "$USERNAME" ]; then
|
|
echo "错误: 用户名不能为空"
|
|
exit 1
|
|
fi
|
|
|
|
# 交互式获取密码(隐藏输入)
|
|
read -sp "请输入 Docker Registry 密码: " PASSWORD
|
|
echo ""
|
|
if [ -z "$PASSWORD" ]; then
|
|
echo "错误: 密码不能为空"
|
|
exit 1
|
|
fi
|
|
|
|
# 交互式获取 Kubernetes 命名空间
|
|
read -p "请输入 Kubernetes 命名空间 [default]: " NAMESPACE
|
|
NAMESPACE="${NAMESPACE:-default}"
|
|
|
|
# 交互式获取 Registry 地址(带默认值)
|
|
read -p "请输入 Docker Registry 地址 [https://index.docker.io/v1/]: " REGISTRY
|
|
REGISTRY="${REGISTRY:-https://index.docker.io/v1/}"
|
|
|
|
OUTPUT_FILE="./config.json"
|
|
|
|
echo ""
|
|
echo "正在生成 Docker config.json 文件..."
|
|
|
|
AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64 | tr -d '\n')
|
|
|
|
cat > "$OUTPUT_FILE" <<EOF
|
|
{
|
|
"auths": {
|
|
"$REGISTRY": {
|
|
"auth": "$AUTH"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
|
|
echo "Docker config.json 已生成: $OUTPUT_FILE"
|
|
echo ""
|
|
echo "正在创建 Kubernetes Secret..."
|
|
kubectl -n $NAMESPACE create secret generic image-repo-secret --from-file=.dockerconfigjson=$OUTPUT_FILE --from-file=config.json=$OUTPUT_FILE --type=kubernetes.io/dockerconfigjson
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "✓ Secret 'image-repo-secret' 已在命名空间 '$NAMESPACE' 中成功创建!"
|
|
else
|
|
echo ""
|
|
echo "✗ 创建 Secret 失败,请检查错误信息"
|
|
rm "$OUTPUT_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
rm "$OUTPUT_FILE"
|
|
echo "临时文件已清理" |