From 8c3f2f21c34593ac2fc44962a5a98541b8d73389 Mon Sep 17 00:00:00 2001 From: hanhan <2596194220@qq.com> Date: Sun, 10 May 2026 14:21:00 +0000 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=20.onedev-buildspec.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .onedev-buildspec.yml | 65 ++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index b88b87a..636d6d8 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -1,34 +1,35 @@ version: 43 jobs: - - name: 构建项目 - steps: - # 步骤1:从代码仓库拉取源代码 - - type: CheckoutStep - name: 拉取代码 - cloneCredential: - type: DefaultCredential # 使用默认凭证(当前用户权限) - withLfs: false # 不拉取 LFS 大文件 - withSubmodules: false # 不拉取子模块 - checkoutPath: '@project_path@' # 检出到项目路径变量指定的位置 - condition: SUCCESSFUL # 当前置步骤成功时执行 - optional: false # 此步骤不可跳过 - - # 步骤2:构建并推送 Docker 镜像 - - type: BuildImageStep - name: 构建docker镜像 - buildPath: '@project_path@' # 构建上下文路径(项目根目录) - output: - type: RegistryOutput # 输出类型:推送到镜像仓库 - tags: '@server@/recipe_tool/recipe_tool:latest' # 镜像标签格式:服务器地址/项目名/镜像名:版本 - registryLogins: # 镜像仓库登录配置 - - registryUrl: https://git.hanhan.ltd # 仓库地址(带协议) - userName: '@job_token@' # 用户名使用内置任务令牌 - passwordSecret: docker-push # 密码使用自定义密钥(需提前在 Job Secrets 中创建) - condition: SUCCESSFUL # 当前置步骤成功时执行 - optional: false # 此步骤不可跳过 - - jobExecutor: docker # 使用 Docker 执行器运行此任务 - retryCondition: never # 失败时不自动重试 - maxRetries: 3 # 最大重试次数(因 retryCondition: never 实际无效) - retryDelay: 30 # 重试间隔时间(秒) - timeout: 14400 # 任务超时时间(4小时) \ No newline at end of file +- name: 构建项目 + steps: + - type: CheckoutStep + name: 拉取代码 + cloneCredential: + type: DefaultCredential + withLfs: false + withSubmodules: false + checkoutPath: '@project_path@' + condition: SUCCESSFUL + optional: false + - type: BuildImageStep + name: 构建docker镜像 + buildPath: '@project_path@' + output: + type: RegistryOutput + tags: '@server@/recipe_tool/recipe_tool:latest' + registryLogins: + - registryUrl: https://git.hanhan.ltd + userName: '@job_token@' + passwordSecret: docker-push + condition: SUCCESSFUL + optional: false + jobExecutor: docker + triggers: + - type: BranchUpdateTrigger + branches: main + userMatch: anyone + projects: recipe_tool + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400