208 lines
7.3 KiB
YAML
208 lines
7.3 KiB
YAML
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: Nocr (Kaniko)
|
|
|
|
metadata:
|
|
namespace: musk-drone
|
|
|
|
trigger:
|
|
ref:
|
|
- refs/tags/*
|
|
#- refs/heads/main
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
|
|
- name: clone
|
|
image: alpine/git
|
|
commands:
|
|
- git clone https://gitea.musk.fun/nocr/flea
|
|
- cd flea
|
|
- git submodule update --init --recursive
|
|
|
|
- name: prepare-dotnet
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- echo "=== .NET SDK Info ==="
|
|
- dotnet --info
|
|
- echo "=== Restore all projects to warm up cache ==="
|
|
- cd flea
|
|
- find . -name '*.sln' -exec dotnet restore {} \;
|
|
|
|
# 🐋 Kaniko steps with caching enabled
|
|
|
|
- name: build & push telegram-listener
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/telegram-listener
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.TelegramListener.Host/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/telegram_listener:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/telegram_listener:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-telegram-listener
|
|
--verbosity=info
|
|
depends_on:
|
|
- prepare-dotnet
|
|
|
|
- name: build & push text-matcher
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/text-matcher
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.TextMatcher.Host/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/text_matcher:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/text_matcher:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-text-matcher
|
|
--verbosity=info
|
|
depends_on:
|
|
- build & push telegram-listener
|
|
|
|
- name: build & push users
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/users
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.Users.Host/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/users:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/users:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-users
|
|
--verbosity=info
|
|
depends_on:
|
|
- build & push text-matcher
|
|
|
|
- name: build & push telegram-client
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/telegram-client
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.TelegramClient.Host/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/telegram_client:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/telegram_client:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-telegram-client
|
|
--verbosity=info
|
|
depends_on:
|
|
- build & push users
|
|
|
|
- name: build & push text-matcher migrator
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/text-matcher
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.TextMatcher.Migrator/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/text_matcher_migrator:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/text_matcher_migrator:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-text-matcher-migrator
|
|
--verbosity=info
|
|
depends_on:
|
|
- build & push telegram-client
|
|
|
|
- name: build & push users migrator
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
environment:
|
|
HUB_USERNAME:
|
|
from_secret: hub_username
|
|
HUB_PASSWORD:
|
|
from_secret: hub_password
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"hub.musk.fun\":{\"username\":\"$HUB_USERNAME\",\"password\":\"$HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- cd flea/users
|
|
- /kaniko/executor
|
|
--context=.
|
|
--dockerfile=src/Nocr.Users.Migrator/Dockerfile
|
|
--destination=hub.musk.fun/k8s/nocr/users_migrator:${DRONE_COMMIT_SHA:0:7}
|
|
--destination=hub.musk.fun/k8s/nocr/users_migrator:latest
|
|
--cache=true
|
|
--cache-repo=hub.musk.fun/k8s/cache/nocr-users-migrator
|
|
--verbosity=info
|
|
depends_on:
|
|
- build & push text-matcher migrator
|
|
|
|
# 📦 NuGet publishing (оставляем .NET SDK)
|
|
- name: publish telegram-listener nuget
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
environment:
|
|
VERSION: ${DRONE_TAG}
|
|
NUGETAPIKEY:
|
|
from_secret: nuget_musk_api_key
|
|
commands:
|
|
- dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json
|
|
- dotnet pack ./flea/telegram-listener/Nocr.TelegramListener.sln -o ./flea/telegram-listener/bin
|
|
- dotnet nuget push ./flea/telegram-listener/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
|
|
depends_on:
|
|
- build & push users migrator
|
|
|
|
- name: publish text-matcher nuget
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
environment:
|
|
VERSION: ${DRONE_TAG}
|
|
NUGETAPIKEY:
|
|
from_secret: nuget_musk_api_key
|
|
commands:
|
|
- dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json
|
|
- dotnet pack ./flea/text-matcher/Nocr.TextMatcher.sln -o ./flea/text-matcher/bin
|
|
- dotnet nuget push ./flea/text-matcher/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
|
|
depends_on:
|
|
- publish telegram-listener nuget
|
|
|
|
- name: publish users nuget
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
environment:
|
|
VERSION: ${DRONE_TAG}
|
|
NUGETAPIKEY:
|
|
from_secret: nuget_musk_api_key
|
|
commands:
|
|
- dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json
|
|
- dotnet pack ./flea/users/Nocr.Users.sln -o ./flea/users/bin
|
|
- dotnet nuget push ./flea/users/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
|
|
depends_on:
|
|
- publish text-matcher nuget
|