-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.77 KB
/
Copy pathcd.yml
File metadata and controls
47 lines (41 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: CD
# Деплой после успешной публикации образа (workflow_run после Docker).
# Self-hosted runner внутри Lima VM — прямой доступ к kind (README §8).
# Неудачный rollout или smoke test = failed pipeline (README §37).
on:
workflow_run:
workflows: [Docker]
types: [completed]
jobs:
deploy:
if: github.event.workflow_run.conclusion == 'success'
runs-on: [self-hosted, Linux, ARM64]
permissions:
contents: read
env:
KUBECONFIG: /opt/lab/kubeconfig-cd
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
# полная история нужна для git describe --tags
fetch-depth: 0
# ВАЖНО: в workflow_run от тег-пуша head_branch = имя ветки (main),
# а не тег. Версию берём из тега, указывающего на собранный commit.
- name: Derive version
id: ver
run: |
git fetch --tags --force origin
VERSION=$(git describe --tags --exact-match HEAD | sed 's/^v//')
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Helm upgrade
run: |
helm upgrade --install cloudshare helm/cloudshare -n cloudshare \
--set "image.repository=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/cloudshare" \
--set "image.tag=${{ steps.ver.outputs.VERSION }}" \
--set serviceMonitor.enabled=true \
--atomic --timeout 300s
- name: Wait for rollout
run: kubectl -n cloudshare rollout status --timeout=300s deploy/cloudshare
- name: Smoke test (health/upload/list/download/delete)
run: bash scripts/smoke-test.sh