# CI/CD项目配置文件 # 文件名: .ci-config.yml # 放置在项目根目录 # 项目基本信息 project: name: "jenkins-demo" type: "java-maven" # 支持: java-maven, java-gradle, nodejs, python, dotnet version: "1.0.0" description: "Spring Boot演示项目" # 构建配置 build: # JDK版本(java项目专用) jdk: "17" # Maven配置(java-maven项目专用) maven: goals: ["clean", "compile", "test", "package"] profiles: ["default"] skip_tests: false # Node.js配置(nodejs项目专用) nodejs: version: "18" package_manager: "npm" # npm, yarn, pnpm build_command: "npm run build" test_command: "npm test" # Python配置(python项目专用) python: version: "3.9" requirements_file: "requirements.txt" test_command: "pytest" # 自定义构建命令 custom_commands: pre_build: [] post_build: [] # 测试配置 test: unit_tests: enabled: true command: "mvn test" reports: "target/surefire-reports/*.xml" integration_tests: enabled: true command: "mvn verify -Pintegration-test" reports: "target/failsafe-reports/*.xml" coverage: enabled: true tool: "jacoco" # jacoco, cobertura threshold: 80 reports: "target/site/jacoco/jacoco.xml" # 代码质量 quality: sonarqube: enabled: true project_key: "jenkins-demo" host_url: "http://116.62.163.84:15010" quality_gate: true checkstyle: enabled: false config_file: "checkstyle.xml" spotbugs: enabled: false # Docker配置 docker: enabled: true dockerfile: "Dockerfile" image_name: "jenkins-demo" registry: "" # 私有镜像仓库地址,空表示本地 build_args: {} # 部署配置 deploy: target: "test" # test, staging, production # 测试环境 test: server: "116.62.163.84" port: 8080 health_check: "/api/health" container_name: "jenkins-demo-test" # 预发布环境 staging: server: "116.62.163.84" port: 8090 health_check: "/api/health" container_name: "jenkins-demo-staging" # 生产环境 production: server: "116.62.163.84" port: 80 health_check: "/api/health" container_name: "jenkins-demo-prod" manual_approval: true # 通知配置 notifications: email: enabled: false recipients: ["dev-team@company.com"] slack: enabled: false channel: "#ci-cd" webhook_url: "" dingtalk: enabled: false webhook_url: "" secret: "" # 高级配置 advanced: # 并行构建 parallel_builds: true # 缓存配置 cache: maven_repository: true node_modules: true pip_cache: true # 安全扫描 security: dependency_check: true image_scan: true # 构建超时(分钟) timeout: 30 # 保留构建数量 build_retention: 10