Merge pull request 'issues/5' (#6) from issues/5 into main

Reviewed-on: #6
This commit is contained in:
ruberoid 2025-10-16 13:14:22 +00:00
commit b2a4b8112d
5 changed files with 63 additions and 369 deletions

View File

@ -1,403 +1,96 @@
--- ---
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 🧪 Pipeline 1: Feature Branch Validation
# Trigger: Push to feature/* or fix/* branches
# Purpose: Fast feedback for developers - build and test only
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
kind: pipeline kind: pipeline
type: kubernetes type: kubernetes
name: Nocr (Kaniko) name: feature-validation
metadata: metadata:
namespace: musk-drone namespace: musk-drone
trigger: trigger:
ref: ref:
- refs/tags/* - refs/heads/feature/*
#- refs/heads/main - refs/heads/issues/*
- refs/heads/fix/*
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
# 🐋 Kaniko steps with caching enabled
# 🚀 Optimized: 3 parallel build streams
#
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 🔵 Stream 1: telegram-listener → telegram-client
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- name: telegram-listener-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- clone
- name: telegram-client-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- telegram-listener-build-push
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 🟢 Stream 2: text-matcher → text-matcher-migrator
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- name: text-matcher-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- clone
- name: text-matcher-migrator-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- text-matcher-build-push
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 🟡 Stream 3: users → users-migrator
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- name: users-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- clone
- name: users-migrator-build-push
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
--compressed-caching=true
--verbosity=info
depends_on:
- users-build-push
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 📦 NuGet publishing - 3 parallel streams after all builds complete
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- name: telegram-listener-nuget-publish
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:
- telegram-client-build-push
- text-matcher-migrator-build-push
- users-migrator-build-push
- name: text-matcher-nuget-publish
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:
- telegram-client-build-push
- text-matcher-migrator-build-push
- users-migrator-build-push
- name: users-nuget-publish
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:
- telegram-client-build-push
- text-matcher-migrator-build-push
- users-migrator-build-push
---
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 📦 Contracts-only pipeline for telegram-listener
# Trigger: commit message contains "contracts_only:telegram_listener"
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
kind: pipeline
type: kubernetes
name: telegram-listener-contracts-only
metadata:
namespace: musk-drone
trigger:
ref:
- refs/tags/*
event: event:
- tag - push
clone: clone:
disable: true disable: true
# Service container for Testcontainers
services:
- name: docker
image: docker:27-dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
- name: nuget-cache
temp: {}
steps: steps:
- name: clone - name: clone
image: alpine/git image: alpine/git
commands: commands:
- git clone https://gitea.musk.fun/nocr/flea - git clone https://gitea.musk.fun/nocr/flea
- cd flea - cd flea
- git checkout $DRONE_COMMIT
- git submodule update --init --recursive - git submodule update --init --recursive
- name: check-commit-message - name: dotnet-restore
image: alpine/git image: mcr.microsoft.com/dotnet/sdk:8.0
volumes:
- name: nuget-cache
path: /root/.nuget/packages
commands: commands:
- cd flea - cd flea
- COMMIT_MSG=$(git log -1 --pretty=%B) - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json
- echo "Commit message':' $COMMIT_MSG" - echo "🔄 Restoring all projects..."
- | - dotnet restore telegram-listener/Nocr.TelegramListener.sln
if echo "$COMMIT_MSG" | grep -q "contracts_only:telegram_listener"; then - dotnet restore telegram-client/Nocr.TelegramClient.sln
echo "✅ Commit message contains 'contracts_only:telegram_listener', proceeding..." - dotnet restore text-matcher/Nocr.TextMatcher.sln
exit 0 - dotnet restore users/Nocr.Users.sln
else
echo "❌ Commit message does not contain 'contracts_only:telegram_listener', skipping..."
exit 78
fi
depends_on: depends_on:
- clone - clone
- name: telegram-listener-contracts-publish - name: dotnet-build
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
environment: volumes:
VERSION: ${DRONE_TAG} - name: nuget-cache
NUGETAPIKEY: path: /root/.nuget/packages
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 -p:PackageVersion=${DRONE_TAG}
- dotnet nuget push ./flea/telegram-listener/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
depends_on:
- check-commit-message
---
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 📦 Contracts-only pipeline for text-matcher
# Trigger: commit message contains "contracts_only:text_matcher"
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
kind: pipeline
type: kubernetes
name: text-matcher-contracts-only
metadata:
namespace: musk-drone
trigger:
ref:
- refs/tags/*
event:
- tag
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: check-commit-message
image: alpine/git
commands: commands:
- cd flea - cd flea
- COMMIT_MSG=$(git log -1 --pretty=%B) - echo "🔨 Building all projects..."
- echo "Commit message':' $COMMIT_MSG" - dotnet build telegram-listener/Nocr.TelegramListener.sln --no-restore -c Debug
- | - dotnet build telegram-client/Nocr.TelegramClient.sln --no-restore -c Debug
if echo "$COMMIT_MSG" | grep -q "contracts_only:text_matcher"; then - dotnet build text-matcher/Nocr.TextMatcher.sln --no-restore -c Debug
echo "✅ Commit message contains 'contracts_only:text_matcher', proceeding..." - dotnet build users/Nocr.Users.sln --no-restore -c Debug
exit 0
else
echo "❌ Commit message does not contain 'contracts_only:text_matcher', skipping..."
exit 78
fi
depends_on: depends_on:
- clone - dotnet-restore
- name: text-matcher-contracts-publish - name: dotnet-test
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
volumes:
- name: nuget-cache
path: /root/.nuget/packages
- name: dockersock
path: /var/run
environment: environment:
VERSION: ${DRONE_TAG} DOCKER_HOST: unix:///var/run/docker.sock
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 -p:PackageVersion=${DRONE_TAG}
- dotnet nuget push ./flea/text-matcher/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
depends_on:
- check-commit-message
---
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 📦 Contracts-only pipeline for users
# Trigger: commit message contains "contracts_only:users"
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
kind: pipeline
type: kubernetes
name: users-contracts-only
metadata:
namespace: musk-drone
trigger:
ref:
- refs/tags/*
event:
- tag
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: check-commit-message
image: alpine/git
commands: commands:
- cd flea - cd flea
- COMMIT_MSG=$(git log -1 --pretty=%B) - echo "🧪 Running tests..."
- echo "Commit message':' $COMMIT_MSG" - dotnet test text-matcher/Nocr.TextMatcher.sln --no-build -c Debug --logger trx --results-directory ./test-results
- | - echo "✅ Tests completed"
if echo "$COMMIT_MSG" | grep -q "contracts_only:users"; then
echo "✅ Commit message contains 'contracts_only:users', proceeding..."
exit 0
else
echo "❌ Commit message does not contain 'contracts_only:users', skipping..."
exit 78
fi
depends_on: depends_on:
- clone - dotnet-build
- docker
- name: users-contracts-publish
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 -p:PackageVersion=${DRONE_TAG}
- dotnet nuget push ./flea/users/bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate
depends_on:
- check-commit-message

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
!.nocr.env.example !.nocr.env.example
.mono/ .mono/
WTelegram.session WTelegram.session
.claude/

@ -1 +1 @@
Subproject commit ccd1c31f1d99afdc028fdc8ba8676de742f43926 Subproject commit b754ae1c5b50feb757237c2036e0e25432cdd1e3

@ -1 +1 @@
Subproject commit 3802eb9dd6a428041c02c947034942973faa0560 Subproject commit 7030e7bce2004ea342ceedf9eb5126077e267b72

@ -1 +1 @@
Subproject commit f3df86c90ae3bc62ab55aac694b37c5a751b7c68 Subproject commit e0b6beab7e6ccdf3d89b56d07abef3b619cbfa32