Compare commits
84 Commits
fa2c1e58e9
...
fix-again
| Author | SHA1 | Date | |
|---|---|---|---|
| a2c38737b4 | |||
| bd4d6d5655 | |||
| 2a6b52c461 | |||
| d4987ff717 | |||
| feb7bf12ed | |||
| 99393d16ce | |||
| 2a74089e37 | |||
| 3398c4f76f | |||
| 26a57c2206 | |||
| 38d562af9a | |||
| 64eb83f489 | |||
| 8ebded5c3f | |||
| ae79a067c4 | |||
| 6319fea371 | |||
| 768a35108a | |||
| cc4ec94402 | |||
| 872706e2b6 | |||
| d4604aa6fb | |||
| 2e82989ca0 | |||
| a67aaf3ca9 | |||
| 5ac880d37d | |||
| fd5d7e2cd4 | |||
| 3c01a716e6 | |||
| f0f354a8d4 | |||
| 8864f9585e | |||
| b7fb2ed335 | |||
| 760b6a8257 | |||
| d7bae2b72f | |||
| 2e4141834e | |||
| 4576ab5751 | |||
| 5114bcf9fe | |||
| a6877dda7e | |||
| 6d04254346 | |||
| 50c5bc458a | |||
| 31eccd5c09 | |||
| a0f83b72d1 | |||
| fc1da26055 | |||
| 8689d0d108 | |||
| 86934c05e8 | |||
| 52f6139528 | |||
| de7b8c7d7f | |||
| 1fdc459c07 | |||
| 57998e19a9 | |||
| 9c829b3543 | |||
| 6c1d7a9176 | |||
| 23c6930c11 | |||
| f1e3fc9bae | |||
| bac7e0abb3 | |||
| f816482983 | |||
| 2e1a74b96c | |||
| 2daf21ea55 | |||
| 2d6aa07554 | |||
| 9aeb793f01 | |||
| 30764b992f | |||
| e88e4ea301 | |||
| 1f046574b5 | |||
| a11bec63b9 | |||
| 7356e38489 | |||
| 68a19a3df7 | |||
| 67647fb4dd | |||
| dc07d5d072 | |||
| 3a09c44958 | |||
| abde7da623 | |||
| 5f90f6f544 | |||
| b09c683175 | |||
| 321d04ed3d | |||
| 630d1767b1 | |||
| b827427591 | |||
| 59d50a60ed | |||
| 5bf1f99e2e | |||
| 1aba1d5df0 | |||
| 56927923ad | |||
| 3ad43d0a1d | |||
| 433faca4b8 | |||
| 67b06db4ed | |||
| e1d609741a | |||
| 6df55bdba6 | |||
| ccdccf017d | |||
| 6f45d23dcf | |||
| c5f51b48ae | |||
| 3738ebbf5a | |||
| 15a1443b9a | |||
| 3d8578c9a2 | |||
| f50569e257 |
@@ -41,11 +41,14 @@ runs:
|
|||||||
with:
|
with:
|
||||||
version: 3.1.3
|
version: 3.1.3
|
||||||
command: app actions run ${{ inputs.environment }} migrate --kind Deployment --resource-name ${{github.event.repository.name}}
|
command: app actions run ${{ inputs.environment }} migrate --kind Deployment --resource-name ${{github.event.repository.name}}
|
||||||
- name: Sync changes
|
- name: Sync related deployments
|
||||||
uses: clowdhaus/argo-cd-action/@main
|
shell: bash
|
||||||
with:
|
run: |
|
||||||
version: 3.1.3
|
for name in $(argocd app resources ${{ inputs.environment }} | grep Deploy | grep ${{ github.event.repository.name }} | awk '{print($4)}'); do
|
||||||
command: app sync ${{ inputs.environment }} --resource 'apps:Deployment:*'
|
echo "Syncing $name"
|
||||||
|
argocd app sync ${{ inputs.environment }} --resource "$name"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Refresh secret
|
- name: Refresh secret
|
||||||
uses: clowdhaus/argo-cd-action/@main
|
uses: clowdhaus/argo-cd-action/@main
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -10,16 +10,20 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: build
|
default: build
|
||||||
token:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
to:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Resolve token/from env if missing
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ -z "${{ inputs.token }}" ] && [ -n "${VK_TEAMS_BOT_TOKEN}" ]; then
|
||||||
|
echo "token=${VK_TEAMS_BOT_TOKEN}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
if [ -z "${{ inputs.to }}" ] && [ -n "${VK_TEAMS_CHAT_ID}" ]; then
|
||||||
|
echo "to=${VK_TEAMS_CHAT_ID}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set icon
|
- name: Set icon
|
||||||
id: icon
|
id: icon
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -32,22 +36,25 @@ runs:
|
|||||||
*) echo "ICON=ℹ️" >> $GITHUB_ENV ;;
|
*) echo "ICON=ℹ️" >> $GITHUB_ENV ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
- name: Notify VK Teams
|
- name: Notify VK Teams (native)
|
||||||
uses: dosymep/vk-teams-action@v1.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ inputs.token }}
|
|
||||||
to: ${{ inputs.to }}
|
|
||||||
format: MarkdownV2
|
|
||||||
message: |
|
|
||||||
*${{ github.repository }}* \- \[${{ inputs.name }}\]\(${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}\) \
|
|
||||||
was *${{ inputs.result }}* by ${{ github.event.sender.login }} ${{ env.ICON }}
|
|
||||||
|
|
||||||
- name: Wait a bit (ensure send completes)
|
|
||||||
if: always()
|
if: always()
|
||||||
shell: bash
|
shell: bash
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
echo "[DEBUG] Starting sleep to ensure message delivery..."
|
echo "[DEBUG] Sending VK Teams notification..."
|
||||||
date
|
curl -G "https://myteam.mail.ru/bot/v1/messages/sendText" \
|
||||||
|
--data-urlencode "token=${{ env.token }}" \
|
||||||
|
--data-urlencode "chatId=${{ env.to }}" \
|
||||||
|
--data-urlencode "parseMode=MarkdownV2" \
|
||||||
|
--data-urlencode "text=*${{ github.repository }}* - [${{ inputs.name }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}) was *${{ inputs.result }}* by ${{ github.event.sender.login }} ${{ env.ICON }}"
|
||||||
|
|
||||||
|
CODE=$?
|
||||||
|
if [ $CODE -ne 0 ]; then
|
||||||
|
echo "[WARN] VK Teams notification failed with exit code $CODE"
|
||||||
|
else
|
||||||
|
echo "[INFO] VK Teams notification sent successfully"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Делаем паузу, чтобы убедиться, что сообщение дошло
|
||||||
|
echo "[DEBUG] Sleeping 5s to ensure delivery..."
|
||||||
sleep 5
|
sleep 5
|
||||||
echo "[DEBUG] Finished sleep, message should have been delivered."
|
|
||||||
date
|
|
||||||
51
.github/workflows/build.yaml
vendored
51
.github/workflows/build.yaml
vendored
@@ -11,7 +11,14 @@ on:
|
|||||||
force_build:
|
force_build:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
arch:
|
||||||
|
type: string
|
||||||
|
default: "linux/amd64,linux/arm64/v8"
|
||||||
|
secrets:
|
||||||
|
VK_TEAMS_BOT_TOKEN:
|
||||||
|
required: true
|
||||||
|
VK_TEAMS_CHAT_ID:
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -20,13 +27,16 @@ jobs:
|
|||||||
CR_REGISTRY: crp8vh46gd976oq8ipla
|
CR_REGISTRY: crp8vh46gd976oq8ipla
|
||||||
CR_REPO: ${{ github.event.repository.name }}
|
CR_REPO: ${{ github.event.repository.name }}
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: notify
|
- name: Notify (started)
|
||||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
||||||
|
env:
|
||||||
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
||||||
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||||
with:
|
with:
|
||||||
result: 'started'
|
result: started
|
||||||
name: build tag ${{ inputs.tag }}
|
name: build tag ${{ inputs.tag }}
|
||||||
secrets: ${{ toJSON(secrets) }}
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -62,9 +72,10 @@ jobs:
|
|||||||
- name: Restore Docker layer cache
|
- name: Restore Docker layer cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: /cache/buildx-cache
|
path: /cache/${{ github.repository }}/buildx-cache
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-${{ github.repository }}-buildx-${{ hashFiles(format('{0}/Dockerfile', github.workspace), format('{0}/**/requirements.txt', github.workspace), format('{0}/**/*lock*', github.workspace), format('{0}/**/package-lock.json', github.workspace), format('{0}/**/poetry.lock', github.workspace)) }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ github.repository }}-buildx-
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Build and push multi-arch image
|
- name: Build and push multi-arch image
|
||||||
@@ -77,33 +88,41 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SHORT_SHA }}
|
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SHORT_SHA }}
|
||||||
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SAFE_TAG }}
|
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SAFE_TAG }}
|
||||||
platforms: linux/amd64,linux/arm64/v8
|
platforms: ${{ inputs.arch }}
|
||||||
ssh: default
|
ssh: default
|
||||||
no-cache: ${{ inputs.force_build }}
|
no-cache: ${{ inputs.force_build }}
|
||||||
build-args: |
|
build-args: |
|
||||||
GIT_COMMIT=${{ github.sha }}
|
GIT_COMMIT=${{ github.sha }}
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=local,src=/cache/buildx-cache
|
type=local,src=/cache/${{ github.repository }}/buildx-cache
|
||||||
cache-to: |
|
cache-to: |
|
||||||
type=local,dest=/cache/buildx-cache-new,mode=max
|
type=local,dest=/cache/${{ github.repository }}/buildx-cache-new,mode=max
|
||||||
|
|
||||||
- name: Move new cache
|
- name: Move new cache if it exists
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
rm -rf /cache/buildx-cache
|
mkdir -p /cache/${{ github.repository }}
|
||||||
mv /cache/buildx-cache-new /cache/buildx-cache
|
if [ -d /cache/${{ github.repository }}/buildx-cache-new ]; then
|
||||||
|
echo "Found new buildx cache, replacing old one..."
|
||||||
|
rm -rf /cache/${{ github.repository }}/buildx-cache
|
||||||
|
mv /cache/${{ github.repository }}/buildx-cache-new /cache/${{ github.repository }}/buildx-cache
|
||||||
|
else
|
||||||
|
echo "No new buildx cache found, keeping old one."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Save Docker layer cache
|
- name: Save Docker layer cache
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: /cache/buildx-cache
|
path: /cache/${{ github.repository }}/buildx-cache
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-${{ github.repository }}-buildx-${{ hashFiles(format('{0}/Dockerfile', github.workspace), format('{0}/**/requirements.txt', github.workspace), format('{0}/**/*lock*', github.workspace), format('{0}/**/package-lock.json', github.workspace), format('{0}/**/poetry.lock', github.workspace)) }}
|
||||||
|
|
||||||
- name: post-notify
|
- name: Notify (result)
|
||||||
if: always()
|
if: always()
|
||||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
||||||
|
env:
|
||||||
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
||||||
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||||
with:
|
with:
|
||||||
result: ${{ steps.build-step.outcome }}
|
result: ${{ steps.build-step.outcome }}
|
||||||
name: build tag ${{ inputs.tag }}
|
name: build tag ${{ inputs.tag }}
|
||||||
secrets: ${{ toJSON(secrets) }}
|
|
||||||
14
.github/workflows/deployk8s.yaml
vendored
14
.github/workflows/deployk8s.yaml
vendored
@@ -24,7 +24,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
if: contains(format(',{0},', vars.ADMIN_USERS), format(',{0},', github.actor)) || inputs.environment=='stage'
|
if: ${{ contains(format(',{0},', vars.ADMIN_USERS), format(',{0},', github.actor)) || startsWith(inputs.environment, 'stage') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
CR_REGISTRY: crp8vh46gd976oq8ipla
|
CR_REGISTRY: crp8vh46gd976oq8ipla
|
||||||
@@ -32,10 +32,12 @@ jobs:
|
|||||||
TAG: ${{ inputs.tag }}
|
TAG: ${{ inputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: notify
|
- name: notify
|
||||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/notify@HEAD
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
||||||
|
env:
|
||||||
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
||||||
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||||
with:
|
with:
|
||||||
result: 'started'
|
result: 'started'
|
||||||
secrets: ${{ toJSON(secrets) }}
|
|
||||||
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||||
- name: deploy
|
- name: deploy
|
||||||
id: k8s_deploy
|
id: k8s_deploy
|
||||||
@@ -47,8 +49,10 @@ jobs:
|
|||||||
migrate: ${{ inputs.migrate }}
|
migrate: ${{ inputs.migrate }}
|
||||||
- name: post-notify
|
- name: post-notify
|
||||||
if: always()
|
if: always()
|
||||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/notify@HEAD
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
||||||
|
env:
|
||||||
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
||||||
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||||
with:
|
with:
|
||||||
result: ${{ steps.k8s_deploy.outcome }}
|
result: ${{ steps.k8s_deploy.outcome }}
|
||||||
name: k8s deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
name: k8s deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||||
secrets: ${{ toJSON(secrets) }}
|
|
||||||
Reference in New Issue
Block a user