ci: retarget deploy workflow at the k3s test cluster
Old VM's blue-green im-webapp is decommissioned; build+push now targets the mutable :test tag the cluster's kustomize overlay already tracks, then rolls the k3s deployment instead of running /opt/apps/im-webapp/deploy.sh. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
f9d4d48148
commit
d5fc03db0e
@@ -1,10 +1,10 @@
|
||||
name: Deploy Webapp (Blue-Green)
|
||||
name: Deploy im-webapp (k3s test cluster)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
image_tag:
|
||||
description: '镜像tag,留空则使用commit短哈希'
|
||||
description: '镜像tag,默认为 test(与集群 kustomization 里的 newTag 一致)'
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
@@ -17,14 +17,23 @@ jobs:
|
||||
id: vars
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.image_tag }}"
|
||||
[ -z "$TAG" ] && TAG=$(git rev-parse --short HEAD)
|
||||
[ -z "$TAG" ] && TAG=test
|
||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: 构建镜像
|
||||
run: |
|
||||
docker build -t im-webapp:${{ steps.vars.outputs.tag }} \
|
||||
--build-arg TINODE_API_KEY="${{ secrets.TINODE_API_KEY }}" .
|
||||
- name: 登录镜像仓库
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.118im.com -u admin --password-stdin
|
||||
|
||||
- name: 蓝绿部署
|
||||
- name: 构建并推送镜像
|
||||
run: |
|
||||
IMAGE=im-webapp:${{ steps.vars.outputs.tag }} /opt/apps/im-webapp/deploy.sh
|
||||
docker build \
|
||||
--build-arg TINODE_API_KEY="${{ secrets.TINODE_API_KEY }}" \
|
||||
-t git.118im.com/im_team/im-webapp:${{ steps.vars.outputs.tag }} .
|
||||
docker push git.118im.com/im_team/im-webapp:${{ steps.vars.outputs.tag }}
|
||||
|
||||
- name: 部署到k3s测试集群
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
kubectl rollout restart deployment/im-webapp -n im-webapp-system
|
||||
kubectl rollout status deployment/im-webapp -n im-webapp-system --timeout=120s
|
||||
|
||||
Reference in New Issue
Block a user