Compare commits
97 Commits
final3
...
67647fb4dd
| Author | SHA1 | Date | |
|---|---|---|---|
| 67647fb4dd | |||
| dc07d5d072 | |||
| abde7da623 | |||
| 5f90f6f544 | |||
| b09c683175 | |||
| 321d04ed3d | |||
| 630d1767b1 | |||
| b827427591 | |||
| 59d50a60ed | |||
| 5bf1f99e2e | |||
| 1aba1d5df0 | |||
| 56927923ad | |||
| 3ad43d0a1d | |||
| 433faca4b8 | |||
| 67b06db4ed | |||
| e1d609741a | |||
| 6df55bdba6 | |||
| ccdccf017d | |||
| 6f45d23dcf | |||
| c5f51b48ae | |||
| 3738ebbf5a | |||
| 15a1443b9a | |||
| 3d8578c9a2 | |||
| fa2c1e58e9 | |||
| dbabf774c0 | |||
| f50569e257 | |||
| acbcb78390 | |||
| 4e2494a6a1 | |||
| b85e4f9798 | |||
| 479433991c | |||
| 5a2fa01284 | |||
| 42891a309a | |||
| e76a3eb00c | |||
| aacefe062d | |||
| 40b367814b | |||
| 9c7d5abfa3 | |||
| 409baf7d02 | |||
| 7c01158b57 | |||
| 5442db2509 | |||
| 591cf8313a | |||
| aa879e978c | |||
| 4db88c6d1b | |||
| c244186429 | |||
| febd2373d3 | |||
| 648d048439 | |||
| a892574942 | |||
| 9bd73a8611 | |||
| 585585106a | |||
| b2ea6c295f | |||
| 76a1b3c739 | |||
| 3d653b0627 | |||
| 494d1826e2 | |||
| 0c92cb1c0f | |||
| 2c6048860e | |||
| 88b43a1bf3 | |||
| 7ec2c32072 | |||
| 688c0b02cb | |||
| 11c0e09b2b | |||
| 62e29edb81 | |||
| 045e0e1127 | |||
| a69a34ddec | |||
| e846abffba | |||
| 4ae633017a | |||
| 69b76b4b56 | |||
| 12cf195c0b | |||
| f988b0d49c | |||
| cb5d1652a3 | |||
| 2d988f683e | |||
| 3fd05f9744 | |||
| 4b4f23fe19 | |||
| d617b37876 | |||
| 59a26018af | |||
| ca81df01cc | |||
| 8b6a2591e5 | |||
| 247c259580 | |||
| 2e82af57de | |||
| 93a2c05c68 | |||
| 11e31a8d84 | |||
| 5e878c74c5 | |||
| 022140608a | |||
| cdc65c56c7 | |||
| ee21d2a83e | |||
| 3f7d7f3e7a | |||
| ef90927312 | |||
| 8c7b4b5b1b | |||
| ac8829e417 | |||
| 44a12848a4 | |||
| 314dc872cc | |||
| 91eac576a5 | |||
| eb3206bbfc | |||
| fff78aa6b2 | |||
| f5787b5a9f | |||
| 16231c1d55 | |||
| 98511aaa46 | |||
| 1bd7e2c7ab | |||
| 070fa3c928 | |||
| 71c68f7533 |
@@ -21,38 +21,38 @@ runs:
|
||||
- name: Argo Login
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: login
|
||||
options: ${{ vars.ARGO_HOST }} --username ${{ vars.ARGO_USER }} --password ${{ fromJSON(inputs.secrets).ARGO_PASSWORD }}
|
||||
- name: Change tag name
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app set ${{ inputs.environment }} --parameter images.${{github.event.repository.name}}=${{ inputs.tag }}
|
||||
- name: Sync changes
|
||||
if: ${{ inputs.migrate == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app sync ${{ inputs.environment }} --resource apps:Deployment:${{github.event.repository.name}}
|
||||
- name: Migrate
|
||||
if: ${{ inputs.migrate == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} migrate --kind Deployment --resource-name ${{github.event.repository.name}}
|
||||
- name: Sync changes
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app sync ${{ inputs.environment }} --resource 'apps:Deployment:*'
|
||||
- name: Refresh secret
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} refresh --kind ExternalSecret --resource-name vault-${{github.event.repository.name}}
|
||||
- name: Restart service
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 2.13.3
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} restart --kind Deployment --resource-name ${{github.event.repository.name}}
|
||||
@@ -1,30 +0,0 @@
|
||||
name: 'notify'
|
||||
description: 'notify'
|
||||
|
||||
inputs:
|
||||
result:
|
||||
required: false
|
||||
default: "failure"
|
||||
type: string
|
||||
name:
|
||||
required: false
|
||||
type: string
|
||||
default: build
|
||||
secrets:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: mattermost/action-mattermost-notify@master
|
||||
env:
|
||||
icons: '{"success" : ":white_check_mark:", "failure": ":x:", "canceled": ":facepalm:", "started": ":warning:"}'
|
||||
with:
|
||||
MATTERMOST_WEBHOOK_URL: ${{ fromJSON(inputs.secrets).MM_WEBHOOK_URL }}
|
||||
PAYLOAD: |
|
||||
{
|
||||
"text": "${{ github.repository }} [${{inputs.name}}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}) was ${{ inputs.result }} by ${{ github.event.sender.login}} ${{ fromJson(env.icons)[inputs.result]}}"
|
||||
}
|
||||
71
.gitea/actions/vk-notify/action.yaml
Normal file
71
.gitea/actions/vk-notify/action.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
name: 'notify'
|
||||
description: 'Send VK Teams notification'
|
||||
|
||||
inputs:
|
||||
result:
|
||||
required: false
|
||||
default: "failure"
|
||||
type: string
|
||||
name:
|
||||
required: false
|
||||
type: string
|
||||
default: build
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
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
|
||||
id: icon
|
||||
shell: bash
|
||||
run: |
|
||||
case "${{ inputs.result }}" in
|
||||
success) echo "ICON=✅" >> $GITHUB_ENV ;;
|
||||
failure) echo "ICON=❌" >> $GITHUB_ENV ;;
|
||||
canceled) echo "ICON=🤦" >> $GITHUB_ENV ;;
|
||||
started) echo "ICON=⚠️" >> $GITHUB_ENV ;;
|
||||
*) echo "ICON=ℹ️" >> $GITHUB_ENV ;;
|
||||
esac
|
||||
|
||||
- name: Notify VK Teams
|
||||
uses: dosymep/vk-teams-action@v1.0.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
token: ${{ env.token }}
|
||||
to: ${{ env.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()
|
||||
shell: bash
|
||||
run: |
|
||||
echo "[DEBUG] Starting sleep to ensure message delivery..."
|
||||
date
|
||||
sleep 5
|
||||
echo "[DEBUG] Finished sleep, message should have been delivered."
|
||||
date
|
||||
|
||||
- name: Force wait for container cleanup
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
echo "[DEBUG] Waiting for runner cleanup barrier..."
|
||||
# пока Docker демон удаляет контейнер, удерживаем процесс активным
|
||||
for i in {1..5}; do
|
||||
docker ps -a | grep act || break
|
||||
echo "[DEBUG] Runner still cleaning up... $i"
|
||||
sleep 1
|
||||
done
|
||||
echo "[DEBUG] Cleanup done."
|
||||
127
.github/workflows/build.yaml
vendored
127
.github/workflows/build.yaml
vendored
@@ -11,7 +11,11 @@ on:
|
||||
force_build:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
secrets:
|
||||
VK_TEAMS_BOT_TOKEN:
|
||||
required: true
|
||||
VK_TEAMS_CHAT_ID:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -20,52 +24,95 @@ jobs:
|
||||
CR_REGISTRY: crp8vh46gd976oq8ipla
|
||||
CR_REPO: ${{ github.event.repository.name }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Checkout LFS
|
||||
if: ${{ inputs.lfs }}
|
||||
run: |
|
||||
UrlBase=$GITHUB_SERVER_URL; \
|
||||
UrlLfsBase=$UrlBase/${{ github.repository }}.git/info/lfs/objects; \
|
||||
Auth=`/usr/bin/git config --get --local http.$UrlBase/.extraheader`; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/.extraheader ''
|
||||
|
||||
git config --local lfs.transfer.maxretries 1
|
||||
git ls-remote
|
||||
git lfs checkout
|
||||
git lfs fetch
|
||||
git lfs pull
|
||||
#git lfs fetch origin refs/heads/${{ github.head_ref || github.ref_name }}
|
||||
steps:
|
||||
- name: Notify (started)
|
||||
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:
|
||||
result: started
|
||||
name: build tag ${{ inputs.tag }}
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ inputs.lfs }}
|
||||
|
||||
- name: Use ssh key
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: |
|
||||
${{ secrets.LIB_SSH_KEY }}
|
||||
${{ secrets.LIB_NEW_SSH_KEY }}
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
if [ "$NO_CACHE" == "true" ]; then
|
||||
docker build -t cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7} --no-cache --ssh default .
|
||||
else
|
||||
docker build -t cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7} --ssh default .
|
||||
fi
|
||||
env:
|
||||
NO_CACHE: ${{ inputs.force_build || 'false' }}
|
||||
ssh-private-key: |
|
||||
${{ secrets.LIB_SSH_KEY }}
|
||||
${{ secrets.LIB_NEW_SSH_KEY }}
|
||||
|
||||
- name: Yandex Cloud Login
|
||||
uses: yc-actions/yc-cr-login@v2
|
||||
with:
|
||||
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
|
||||
- name: Tag image
|
||||
env:
|
||||
INPUT_TAG: ${{ inputs.tag }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Shorten commit SHA
|
||||
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- name: Normalize tag
|
||||
id: normalize
|
||||
run: |
|
||||
echo ${INPUT_TAG/\//-} ${IMAGE_TAG::7} $INPUT_TAG $IMAGE_TAG
|
||||
docker tag cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7} cr.yandex/$CR_REGISTRY/$CR_REPO:${INPUT_TAG/\//-}
|
||||
- name: Push image
|
||||
env:
|
||||
INPUT_TAG: ${{ inputs.tag }}
|
||||
SAFE_TAG=$(echo "${{ inputs.tag }}" | tr '/' '-')
|
||||
echo "SAFE_TAG=$SAFE_TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Restore Docker layer cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /cache/buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
id: build-step
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
tags: |
|
||||
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SHORT_SHA }}
|
||||
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_REPO }}:${{ env.SAFE_TAG }}
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
ssh: default
|
||||
no-cache: ${{ inputs.force_build }}
|
||||
build-args: |
|
||||
GIT_COMMIT=${{ github.sha }}
|
||||
cache-from: |
|
||||
type=local,src=/cache/buildx-cache
|
||||
cache-to: |
|
||||
type=local,dest=/cache/buildx-cache-new,mode=max
|
||||
|
||||
- name: Move new cache
|
||||
if: always()
|
||||
run: |
|
||||
docker push cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7}
|
||||
docker push cr.yandex/$CR_REGISTRY/$CR_REPO:${INPUT_TAG/\//-}
|
||||
rm -rf /cache/buildx-cache
|
||||
mv /cache/buildx-cache-new /cache/buildx-cache
|
||||
|
||||
- name: Save Docker layer cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /cache/buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
|
||||
- name: Notify (result)
|
||||
if: always()
|
||||
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:
|
||||
result: started
|
||||
name: build tag ${{ inputs.tag }}
|
||||
|
||||
10
.github/workflows/deploy.yaml
vendored
10
.github/workflows/deploy.yaml
vendored
@@ -30,17 +30,7 @@ jobs:
|
||||
CR_REPO: ${{ github.event.repository.name }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
steps:
|
||||
- name: deploy
|
||||
if: inputs.environment == 'prod' || inputs.environment == 'demo'
|
||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/deploy@HEAD
|
||||
with:
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
environment: ${{ inputs.environment }}
|
||||
tag: ${{ inputs.tag }}
|
||||
migrate: ${{ inputs.migrate }}
|
||||
host: ${{ inputs.host }}
|
||||
- name: deploy k8s
|
||||
if: inputs.environment == 'stage'
|
||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/k8s@HEAD
|
||||
with:
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
|
||||
17
.github/workflows/deployk8s.yaml
vendored
17
.github/workflows/deployk8s.yaml
vendored
@@ -38,18 +38,17 @@ jobs:
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||
- name: deploy
|
||||
id: k8s_deploy
|
||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/k8s@HEAD
|
||||
with:
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
environment: ${{ inputs.environment }}
|
||||
tag: ${{ inputs.tag }}
|
||||
migrate: ${{ inputs.migrate }}
|
||||
|
||||
notify:
|
||||
needs: [deploy]
|
||||
if: always()
|
||||
uses: HUB/workflows/.github/workflows/notify.yaml@main
|
||||
with:
|
||||
result: ${{ needs.deploy.result}}
|
||||
name: k8s deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||
secrets: inherit
|
||||
- name: post-notify
|
||||
if: always()
|
||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/notify@HEAD
|
||||
with:
|
||||
result: ${{ steps.k8s_deploy.outcome }}
|
||||
name: k8s deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
20
.github/workflows/notify.yaml
vendored
20
.github/workflows/notify.yaml
vendored
@@ -1,5 +1,3 @@
|
||||
env:
|
||||
icons: '{"success" : ":white_check_mark:", "failure": ":x:", "canceled": ":facepalm:", "started": ":warning:", "": ":boxing_glove:"}'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
@@ -15,11 +13,13 @@ jobs:
|
||||
notify:
|
||||
runs-on: gpu
|
||||
steps:
|
||||
- uses: mattermost/action-mattermost-notify@master
|
||||
with:
|
||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
|
||||
PAYLOAD: |
|
||||
{
|
||||
"text": "${{ github.repository }} [${{inputs.name}}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}) was ${{ inputs.result }} by ${{ github.event.sender.login}} ${{ fromJson(env.icons)[inputs.result]}}"
|
||||
}
|
||||
|
||||
- uses: dosymep/vk-teams-action@v1.0.0
|
||||
env:
|
||||
ICONS: '{"success":"✅","failure":"❌","canceled":"🤦","started":"⚠️"}'
|
||||
with:
|
||||
token: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
||||
to: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||
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 }} ${{ fromJson(env.ICONS)[inputs.result] }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user