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:
|
environment:
|
||||||
NUXT_PORT: 3000
|
NUXT_PORT: 3000
|
||||||
HEALTH_CHECK_TIMEOUT: 30
|
HEALTH_CHECK_TIMEOUT: 30
|
||||||
|
CA_CRT:
|
||||||
|
from_secret: ca-crt
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: node_modules_cache
|
- name: node_modules_cache
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
|
- name: repo-volume
|
||||||
|
emptyDir: {}
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps:
|
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️⃣ 准备环境
|
# 1️⃣ 准备环境
|
||||||
- name: prepare-environment
|
- name: prepare-environment
|
||||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||||
@@ -25,36 +44,43 @@ steps:
|
|||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
- npm --version
|
||||||
- npx nuxt --version || true
|
- npx nuxt --version || true
|
||||||
|
volumeMounts:
|
||||||
|
- name: repo-volume
|
||||||
|
mountPath: /drone/src
|
||||||
|
|
||||||
# 2️⃣ 安装依赖
|
# 2️⃣ 安装依赖
|
||||||
- name: install-dependencies
|
- name: install-dependencies
|
||||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||||
volumes:
|
|
||||||
- name: node_modules_cache
|
|
||||||
path: /app/node_modules
|
|
||||||
commands:
|
commands:
|
||||||
|
- cd /drone/src
|
||||||
- echo "📦 安装项目依赖..."
|
- echo "📦 安装项目依赖..."
|
||||||
- npm ci --prefer-offline --progress=false
|
- npm ci --prefer-offline --progress=false
|
||||||
- echo "✅ 依赖安装完成"
|
- echo "✅ 依赖安装完成"
|
||||||
|
volumeMounts:
|
||||||
|
- name: repo-volume
|
||||||
|
mountPath: /drone/src
|
||||||
|
- name: node_modules_cache
|
||||||
|
mountPath: /drone/src/node_modules
|
||||||
|
|
||||||
# 3️⃣ 构建验证
|
# 3️⃣ 构建验证
|
||||||
- name: build-verification
|
- name: build-verification
|
||||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||||
volumes:
|
|
||||||
- name: node_modules_cache
|
|
||||||
path: /app/node_modules
|
|
||||||
commands:
|
commands:
|
||||||
|
- cd /drone/src
|
||||||
- echo "🔨 验证构建过程..."
|
- echo "🔨 验证构建过程..."
|
||||||
- npm run build
|
- npm run build
|
||||||
- echo "✅ 构建验证通过"
|
- echo "✅ 构建验证通过"
|
||||||
|
volumeMounts:
|
||||||
|
- name: repo-volume
|
||||||
|
mountPath: /drone/src
|
||||||
|
- name: node_modules_cache
|
||||||
|
mountPath: /drone/src/node_modules
|
||||||
|
|
||||||
# 4️⃣ 启动服务并检查运行状态
|
# 4️⃣ 启动服务并检查运行状态
|
||||||
- name: service-start-check
|
- name: service-start-check
|
||||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||||
volumes:
|
|
||||||
- name: node_modules_cache
|
|
||||||
path: /app/node_modules
|
|
||||||
commands:
|
commands:
|
||||||
|
- cd /drone/src
|
||||||
- echo "🌐 启动 Nuxt 服务..."
|
- echo "🌐 启动 Nuxt 服务..."
|
||||||
- npm run start &
|
- npm run start &
|
||||||
- sleep 10
|
- sleep 10
|
||||||
@@ -63,3 +89,8 @@ steps:
|
|||||||
echo "✅ Nuxt 服务启动成功"
|
echo "✅ Nuxt 服务启动成功"
|
||||||
else
|
else
|
||||||
echo "❌ Nuxt 服务启动失败"
|
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