im-server moved from Deployment to StatefulSet in im-deploy-config (native Cluster enablement) -- this workflow's kubectl commands still targeted the old resource type, so every deploy since the migration failed at the final step with "deployments.apps im-server not found" (image built/pushed fine, just never got rolled out). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
39 lines
1.3 KiB
YAML
39 lines
1.3 KiB
YAML
name: Deploy im-server (k3s test cluster)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
image_tag:
|
|
description: '镜像tag,默认为 test(与集群 kustomization 里的 newTag 一致)'
|
|
required: false
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: deploy-host
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: 确定镜像tag
|
|
id: vars
|
|
run: |
|
|
TAG="${{ github.event.inputs.image_tag }}"
|
|
[ -z "$TAG" ] && TAG=test
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: 登录镜像仓库
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.118im.com -u admin --password-stdin
|
|
|
|
- name: 构建并推送镜像(从本仓库源码编译,不是官方预编译包)
|
|
run: |
|
|
docker build -f docker/tinode/Dockerfile.build \
|
|
-t git.118im.com/im_team/im-server:${{ steps.vars.outputs.tag }} .
|
|
docker push git.118im.com/im_team/im-server:${{ steps.vars.outputs.tag }}
|
|
|
|
- name: 部署到k3s测试集群
|
|
run: |
|
|
mkdir -p ~/.kube
|
|
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
|
|
chmod 600 ~/.kube/config
|
|
kubectl rollout restart statefulset/im-server -n im-server-system
|
|
kubectl rollout status statefulset/im-server -n im-server-system --timeout=120s
|