fix(CI): 为step pod添加证书
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
49
.drone.yml
49
.drone.yml
@@ -11,12 +11,31 @@ trigger:
|
||||
environment:
|
||||
NUXT_PORT: 3000
|
||||
HEALTH_CHECK_TIMEOUT: 30
|
||||
CA_CRT:
|
||||
from_secret: ca-crt
|
||||
|
||||
volumes:
|
||||
- name: node_modules_cache
|
||||
emptyDir: {}
|
||||
- name: repo-volume
|
||||
emptyDir: {}
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
# 0️⃣ clone代码覆盖
|
||||
- name: clone
|
||||
image: alpine/git:latest
|
||||
commands:
|
||||
- echo "$CA_CRT" > /usr/local/share/ca-certificates/ca.crt
|
||||
- apk add --no-cache ca-certificates
|
||||
- update-ca-certificates
|
||||
- git clone https://gitea.local.knowai/tobegold574/knowai.git /drone/src
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
|
||||
# 1️⃣ 准备环境
|
||||
- name: prepare-environment
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
@@ -25,36 +44,43 @@ steps:
|
||||
- node --version
|
||||
- npm --version
|
||||
- npx nuxt --version || true
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
|
||||
# 2️⃣ 安装依赖
|
||||
- name: install-dependencies
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
volumes:
|
||||
- name: node_modules_cache
|
||||
path: /app/node_modules
|
||||
commands:
|
||||
- cd /drone/src
|
||||
- echo "📦 安装项目依赖..."
|
||||
- npm ci --prefer-offline --progress=false
|
||||
- echo "✅ 依赖安装完成"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
|
||||
# 3️⃣ 构建验证
|
||||
- name: build-verification
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
volumes:
|
||||
- name: node_modules_cache
|
||||
path: /app/node_modules
|
||||
commands:
|
||||
- cd /drone/src
|
||||
- echo "🔨 验证构建过程..."
|
||||
- npm run build
|
||||
- echo "✅ 构建验证通过"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
|
||||
# 4️⃣ 启动服务并检查运行状态
|
||||
- name: service-start-check
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
volumes:
|
||||
- name: node_modules_cache
|
||||
path: /app/node_modules
|
||||
commands:
|
||||
- cd /drone/src
|
||||
- echo "🌐 启动 Nuxt 服务..."
|
||||
- npm run start &
|
||||
- sleep 10
|
||||
@@ -63,3 +89,8 @@ steps:
|
||||
echo "✅ Nuxt 服务启动成功"
|
||||
else
|
||||
echo "❌ Nuxt 服务启动失败"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
|
||||
Reference in New Issue
Block a user