Compare commits
59 Commits
a0f83b72d1
...
lil-fix
| Author | SHA1 | Date | |
|---|---|---|---|
| c621e392f4 | |||
| 1540fce056 | |||
| 0dcd1b5a97 | |||
| 3c3cf1e01e | |||
| 32235cb102 | |||
| a750a6b0cd | |||
| 04914682ab | |||
| 26d0ef1b21 | |||
| b91d822d12 | |||
| 6b3551e14e | |||
| 455f632cab | |||
| 09181ac7b1 | |||
| 856783726d | |||
| 378b930ccc | |||
| eeb15eb7dc | |||
| 99c7507dd5 | |||
| 6f79b96a0b | |||
| ef5149864b | |||
| f906007246 | |||
| 7d47da47a3 | |||
| 8306409d93 | |||
| 6efe8999bc | |||
| d558a37736 | |||
| 42914c5104 | |||
| 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 |
@@ -14,6 +14,18 @@ inputs:
|
||||
secrets:
|
||||
required: false
|
||||
type: string
|
||||
appName:
|
||||
type: string
|
||||
required: true
|
||||
optionName:
|
||||
type: string
|
||||
required: true
|
||||
tests:
|
||||
type: bool
|
||||
default: false
|
||||
vault:
|
||||
type: bool
|
||||
default: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -28,31 +40,40 @@ runs:
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 3.1.3
|
||||
command: app set ${{ inputs.environment }} --parameter images.${{github.event.repository.name}}=${{ inputs.tag }}
|
||||
command: app set ${{ inputs.environment }} --parameter ${{ inputs.optionName }}=${{ inputs.tag }}
|
||||
- name: Sync changes
|
||||
if: ${{ inputs.migrate == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 3.1.3
|
||||
command: app sync ${{ inputs.environment }} --resource apps:Deployment:${{github.event.repository.name}}
|
||||
command: app sync ${{ inputs.environment }} --resource apps:Deployment:${{ inputs.appName }}
|
||||
- name: Migrate
|
||||
if: ${{ inputs.migrate == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
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: 3.1.3
|
||||
command: app sync ${{ inputs.environment }} --resource 'apps:Deployment:*'
|
||||
command: app actions run ${{ inputs.environment }} migrate --kind Deployment --resource-name ${{ inputs.appName }}
|
||||
- name: Sync related deployments
|
||||
shell: bash
|
||||
run: |
|
||||
for name in $(argocd app resources ${{ inputs.environment }} | grep Deploy | grep ${{ inputs.appName }} | awk '{print($4)}'); do
|
||||
echo "Syncing $name"
|
||||
argocd app sync ${{ inputs.environment }} --resource apps:Deployment:$name;
|
||||
done
|
||||
- name: Refresh secret
|
||||
if: ${{ inputs.vault == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} refresh --kind ExternalSecret --resource-name vault-${{github.event.repository.name}}
|
||||
command: app actions run ${{ inputs.environment }} refresh --kind ExternalSecret --resource-name vault-${{ inputs.appName }}
|
||||
- name: Restart service
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} restart --kind Deployment --resource-name ${{github.event.repository.name}}
|
||||
command: app actions run ${{ inputs.environment }} restart --kind Deployment --resource-name ${{ inputs.appName }}
|
||||
- name: Run Tests
|
||||
if: ${{ inputs.tests == 'true' }}
|
||||
uses: clowdhaus/argo-cd-action/@main
|
||||
with:
|
||||
version: 3.1.3
|
||||
command: app actions run ${{ inputs.environment }} run-tests --kind Deployment --resource-name ${{ inputs.appName }}
|
||||
29
.github/workflows/build.yaml
vendored
29
.github/workflows/build.yaml
vendored
@@ -11,6 +11,9 @@ on:
|
||||
force_build:
|
||||
type: boolean
|
||||
default: false
|
||||
arch:
|
||||
type: string
|
||||
default: "linux/amd64,linux/arm64/v8"
|
||||
secrets:
|
||||
VK_TEAMS_BOT_TOKEN:
|
||||
required: true
|
||||
@@ -69,9 +72,10 @@ jobs:
|
||||
- name: Restore Docker layer cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /cache/buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
path: /cache/${{ github.repository }}/buildx-cache
|
||||
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: |
|
||||
${{ runner.os }}-${{ github.repository }}-buildx-
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
@@ -84,33 +88,34 @@ jobs:
|
||||
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
|
||||
platforms: ${{ inputs.arch }}
|
||||
ssh: default
|
||||
no-cache: ${{ inputs.force_build }}
|
||||
build-args: |
|
||||
GIT_COMMIT=${{ github.sha }}
|
||||
cache-from: |
|
||||
type=local,src=/cache/buildx-cache
|
||||
type=local,src=/cache/${{ github.repository }}/buildx-cache
|
||||
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 if it exists
|
||||
if: always()
|
||||
if: steps.build-step.outcome == 'success'
|
||||
run: |
|
||||
if [ -d /cache/buildx-cache-new ]; then
|
||||
mkdir -p /cache/${{ github.repository }}
|
||||
if [ -d /cache/${{ github.repository }}/buildx-cache-new ]; then
|
||||
echo "Found new buildx cache, replacing old one..."
|
||||
rm -rf /cache/buildx-cache
|
||||
mv /cache/buildx-cache-new /cache/buildx-cache
|
||||
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
|
||||
if: always()
|
||||
if: steps.build-step.outcome == 'success'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /cache/buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
path: /cache/${{ github.repository }}/buildx-cache
|
||||
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: Notify (result)
|
||||
if: always()
|
||||
|
||||
20
.github/workflows/deployk8s.yaml
vendored
20
.github/workflows/deployk8s.yaml
vendored
@@ -21,10 +21,22 @@ on:
|
||||
host:
|
||||
type: string
|
||||
required: true
|
||||
name:
|
||||
type: string
|
||||
required: false
|
||||
option:
|
||||
type: string
|
||||
required: false
|
||||
tests:
|
||||
type: string
|
||||
default: true
|
||||
vault:
|
||||
type: string
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
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
|
||||
env:
|
||||
CR_REGISTRY: crp8vh46gd976oq8ipla
|
||||
@@ -47,6 +59,10 @@ jobs:
|
||||
environment: ${{ inputs.environment }}
|
||||
tag: ${{ inputs.tag }}
|
||||
migrate: ${{ inputs.migrate }}
|
||||
appName: ${{ inputs.name || github.event.repository.name }}
|
||||
optionName: ${{ inputs.option || format('images.{0}', github.event.repository.name) }}
|
||||
tests: ${{ inputs.tests }}
|
||||
vault: ${{ inputs.vault }}
|
||||
- name: post-notify
|
||||
if: always()
|
||||
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
||||
@@ -55,4 +71,4 @@ jobs:
|
||||
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
||||
with:
|
||||
result: ${{ steps.k8s_deploy.outcome }}
|
||||
name: k8s deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
||||
|
||||
Reference in New Issue
Block a user