From c1a043c6eb700f58954ae6873459c6f7acb82a64 Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 15:43:57 +0400 Subject: [PATCH 1/8] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=BE=D0=B1=D1=83?= =?UTF-8?q?=D1=8E=20=D0=BF=D1=80=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF=D0=B5=D1=80=D0=B2=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=81=D0=B1=D0=BE=D1=80=D0=BE=D1=87=D0=BD=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=B1=D0=BB=D0=BE=D0=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 633 ++++++++++++++++++++++++++++++++++++----------------- .gitignore | 1 + 2 files changed, 434 insertions(+), 200 deletions(-) diff --git a/.drone.yml b/.drone.yml index 82a9c64..e120fe8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,33 +1,419 @@ --- +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# 🧪 Pipeline 1: Feature Branch Validation +# Trigger: Push to feature/* or fix/* branches +# Purpose: Fast feedback for developers - build and test only +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ kind: pipeline type: kubernetes -name: Nocr (Kaniko) +name: feature-validation metadata: namespace: musk-drone trigger: ref: - - refs/tags/* - #- refs/heads/main + - refs/heads/feature/* + - refs/heads/issues/* + - refs/heads/fix/* + event: + - push clone: disable: true -steps: +# 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: - name: clone image: alpine/git commands: - git clone https://gitea.musk.fun/nocr/flea - cd flea + - git checkout $DRONE_COMMIT - git submodule update --init --recursive - # 🐋 Kaniko steps with caching enabled - # 🚀 Optimized: 3 parallel build streams - # + - name: dotnet-restore + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + commands: + - cd flea + - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + - echo "🔄 Restoring all projects..." + - dotnet restore telegram-listener/Nocr.TelegramListener.sln + - dotnet restore telegram-client/Nocr.TelegramClient.sln + - dotnet restore text-matcher/Nocr.TextMatcher.sln + - dotnet restore users/Nocr.Users.sln + depends_on: + - clone + + - name: dotnet-build + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + commands: + - cd flea + - echo "🔨 Building all projects..." + - dotnet build telegram-listener/Nocr.TelegramListener.sln --no-restore -c Debug + - dotnet build telegram-client/Nocr.TelegramClient.sln --no-restore -c Debug + - dotnet build text-matcher/Nocr.TextMatcher.sln --no-restore -c Debug + - dotnet build users/Nocr.Users.sln --no-restore -c Debug + depends_on: + - dotnet-restore + + - name: dotnet-test + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + - name: dockersock + path: /var/run + environment: + DOCKER_HOST: unix:///var/run/docker.sock + commands: + - cd flea + - echo "🧪 Running tests..." + - dotnet test text-matcher/Nocr.TextMatcher.sln --no-build -c Debug --logger trx --results-directory ./test-results + - echo "✅ Tests completed" + depends_on: + - dotnet-build + - docker + +--- +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# 📝 Pipeline 2: Main Branch Validation +# Trigger: Push to main branch +# Purpose: Validate main branch after merge +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +kind: pipeline +type: kubernetes +name: main-validation + +metadata: + namespace: musk-drone + +trigger: + ref: + - refs/heads/main + event: + - push + +clone: + disable: true + +services: + - name: docker + image: docker:27-dind + privileged: true + volumes: + - name: dockersock + path: /var/run + +volumes: + - name: dockersock + temp: {} + - name: nuget-cache + temp: {} + +steps: + - name: clone + image: alpine/git + commands: + - git clone https://gitea.musk.fun/nocr/flea + - cd flea + - git checkout $DRONE_COMMIT + - git submodule update --init --recursive + + - name: dotnet-restore + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + commands: + - cd flea + - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + - dotnet restore telegram-listener/Nocr.TelegramListener.sln + - dotnet restore telegram-client/Nocr.TelegramClient.sln + - dotnet restore text-matcher/Nocr.TextMatcher.sln + - dotnet restore users/Nocr.Users.sln + depends_on: + - clone + + - name: dotnet-build + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + commands: + - cd flea + - dotnet build telegram-listener/Nocr.TelegramListener.sln --no-restore -c Release + - dotnet build telegram-client/Nocr.TelegramClient.sln --no-restore -c Release + - dotnet build text-matcher/Nocr.TextMatcher.sln --no-restore -c Release + - dotnet build users/Nocr.Users.sln --no-restore -c Release + depends_on: + - dotnet-restore + + - name: dotnet-test + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + - name: dockersock + path: /var/run + environment: + DOCKER_HOST: unix:///var/run/docker.sock + commands: + - cd flea + - dotnet test text-matcher/Nocr.TextMatcher.sln --no-build -c Release --logger trx --results-directory ./test-results + depends_on: + - dotnet-build + - docker + +--- +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# 📦 Pipeline 3: Contracts-Only Publish +# Trigger: Tag with commit message containing "contracts_only:" +# Purpose: Fast publish of contract packages without building images +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +kind: pipeline +type: kubernetes +name: contracts-publish + +metadata: + namespace: musk-drone + +trigger: + ref: + - refs/tags/* + event: + - tag + +clone: + disable: true + +volumes: + - name: nuget-cache + temp: {} + +steps: + - name: clone + image: alpine/git + commands: + - git clone https://gitea.musk.fun/nocr/flea + - cd flea + - git checkout $DRONE_TAG + - git submodule update --init --recursive + + - name: check-trigger + image: alpine/git + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - echo "Commit message':' $COMMIT_MSG" + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:"; then + echo "✅ contracts_only detected, proceeding..." + exit 0 + else + echo "⏭️ No contracts_only marker, skipping..." + exit 78 + fi + depends_on: + - clone + + - name: telegram-listener-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:telegram_listener"; then + echo "📦 Publishing telegram-listener contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack telegram-listener/Nocr.TelegramListener.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping telegram-listener contracts" + fi + depends_on: + - check-trigger + + - name: text-matcher-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:text_matcher"; then + echo "📦 Publishing text-matcher contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack text-matcher/Nocr.TextMatcher.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping text-matcher contracts" + fi + depends_on: + - check-trigger + + - name: users-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:users"; then + echo "📦 Publishing users contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack users/Nocr.Users.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping users contracts" + fi + depends_on: + - check-trigger + +--- +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# 🚀 Pipeline 4: Full Release +# Trigger: Tag on main branch WITHOUT "contracts_only" or "deploy_only" +# Purpose: Full release cycle - contracts → images → optional deploy +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +kind: pipeline +type: kubernetes +name: full-release + +metadata: + namespace: musk-drone + +trigger: + ref: + - refs/tags/* + event: + - tag + branch: + - main + +clone: + disable: true + +volumes: + - name: nuget-cache + temp: {} + +steps: + - name: clone + image: alpine/git + commands: + - git clone https://gitea.musk.fun/nocr/flea + - cd flea + - git checkout $DRONE_TAG + - git submodule update --init --recursive + + - name: check-trigger + image: alpine/git + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - echo "Commit message':' $COMMIT_MSG" + - | + if echo "$COMMIT_MSG" | grep -qE "contracts_only:|deploy_only:"; then + echo "⏭️ contracts_only or deploy_only detected, skipping full release..." + exit 78 + else + echo "✅ Full release triggered" + exit 0 + fi + depends_on: + - clone + # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - # 🔵 Stream 1: telegram-listener → telegram-client + # STAGE 1: Publish NuGet Contracts (parallel) + # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + - name: telegram-listener-nuget + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + - dotnet pack telegram-listener/Nocr.TelegramListener.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + depends_on: + - check-trigger + + - name: text-matcher-nuget + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + - dotnet pack text-matcher/Nocr.TextMatcher.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + depends_on: + - check-trigger + + - name: users-nuget + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + - dotnet pack users/Nocr.Users.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + depends_on: + - check-trigger + + # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + # STAGE 2: Build Docker Images with Kaniko (3 parallel streams) # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - name: telegram-listener-build-push @@ -45,13 +431,15 @@ steps: --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:${DRONE_TAG} --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 + - telegram-listener-nuget + - text-matcher-nuget + - users-nuget - name: telegram-client-build-push image: gcr.io/kaniko-project/executor:debug @@ -68,18 +456,14 @@ steps: --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:${DRONE_TAG} --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: @@ -95,13 +479,15 @@ steps: --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:${DRONE_TAG} --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 + - telegram-listener-nuget + - text-matcher-nuget + - users-nuget - name: text-matcher-migrator-build-push image: gcr.io/kaniko-project/executor:debug @@ -118,18 +504,14 @@ steps: --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:${DRONE_TAG} --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: @@ -145,13 +527,15 @@ steps: --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:${DRONE_TAG} --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 + - telegram-listener-nuget + - text-matcher-nuget + - users-nuget - name: users-migrator-build-push image: gcr.io/kaniko-project/executor:debug @@ -168,71 +552,41 @@ steps: --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:${DRONE_TAG} --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 + # STAGE 3: Deploy to Kubernetes (optional, based on tag pattern) # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - name: telegram-listener-nuget-publish - image: mcr.microsoft.com/dotnet/sdk:8.0 - environment: - VERSION: ${DRONE_TAG} - NUGETAPIKEY: - from_secret: nuget_musk_api_key + - name: deploy-to-k8s + image: bitnami/kubectl:latest 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 + - cd flea/_deploy/scripts + - chmod +x deploy.sh + - ./deploy.sh ${DRONE_TAG} ${DRONE_COMMIT_SHA:0:7} depends_on: - telegram-client-build-push - text-matcher-migrator-build-push - users-migrator-build-push + when: + ref: + - refs/tags/v* --- # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# 📦 Contracts-only pipeline for telegram-listener -# Trigger: commit message contains "contracts_only:telegram_listener" +# 🚀 Pipeline 5: Deploy-Only +# Trigger: Tag with commit message containing "deploy_only:" +# Purpose: Fast deploy of already-built images # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ kind: pipeline type: kubernetes -name: telegram-listener-contracts-only +name: deploy-only metadata: namespace: musk-drone @@ -252,152 +606,31 @@ steps: commands: - git clone https://gitea.musk.fun/nocr/flea - cd flea + - git checkout $DRONE_TAG - git submodule update --init --recursive - - name: check-commit-message + - name: check-trigger image: alpine/git commands: - cd flea - COMMIT_MSG=$(git log -1 --pretty=%B) - echo "Commit message':' $COMMIT_MSG" - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:telegram_listener"; then - echo "✅ Commit message contains 'contracts_only:telegram_listener', proceeding..." + if echo "$COMMIT_MSG" | grep -q "deploy_only:"; then + echo "✅ deploy_only detected, proceeding..." exit 0 else - echo "❌ Commit message does not contain 'contracts_only:telegram_listener', skipping..." + echo "⏭️ No deploy_only marker, skipping..." exit 78 fi depends_on: - clone - - name: telegram-listener-contracts-publish - image: mcr.microsoft.com/dotnet/sdk:8.0 - environment: - VERSION: ${DRONE_TAG} - NUGETAPIKEY: - from_secret: nuget_musk_api_key + - name: deploy + image: bitnami/kubectl:latest 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 + - cd flea/_deploy/scripts + - chmod +x deploy.sh + - ./deploy.sh ${DRONE_TAG} ${DRONE_COMMIT_SHA:0:7} 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: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message':' $COMMIT_MSG" - - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:text_matcher"; then - echo "✅ Commit message contains 'contracts_only:text_matcher', proceeding..." - exit 0 - else - echo "❌ Commit message does not contain 'contracts_only:text_matcher', skipping..." - exit 78 - fi - depends_on: - - clone - - - name: text-matcher-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/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: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message':' $COMMIT_MSG" - - | - 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: - - clone - - - 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 + - check-trigger diff --git a/.gitignore b/.gitignore index a811809..faf8c96 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ !.nocr.env.example .mono/ WTelegram.session +.claude/ From f274646e1e254b95c7b2a6d0b5775d80c54ee3fc Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 15:45:34 +0400 Subject: [PATCH 2/8] cicd fix. --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index e120fe8..50c988c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,8 +28,8 @@ services: image: docker:27-dind privileged: true volumes: - - name: dockersock - path: /var/run + - name: dockersock + path: /var/run volumes: - name: dockersock @@ -122,8 +122,8 @@ services: image: docker:27-dind privileged: true volumes: - - name: dockersock - path: /var/run + - name: dockersock + path: /var/run volumes: - name: dockersock From 3f0f4d2c05431dbfb9ca73c526320837404aeb0d Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 15:46:51 +0400 Subject: [PATCH 3/8] cicd fix. --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 50c988c..0972571 100644 --- a/.drone.yml +++ b/.drone.yml @@ -225,7 +225,7 @@ steps: commands: - cd flea - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message':' $COMMIT_MSG" + - echo "Commit message - $COMMIT_MSG" - | if echo "$COMMIT_MSG" | grep -q "contracts_only:"; then echo "✅ contracts_only detected, proceeding..." @@ -348,7 +348,7 @@ steps: commands: - cd flea - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message':' $COMMIT_MSG" + - echo "Commit message - $COMMIT_MSG" - | if echo "$COMMIT_MSG" | grep -qE "contracts_only:|deploy_only:"; then echo "⏭️ contracts_only or deploy_only detected, skipping full release..." @@ -614,7 +614,7 @@ steps: commands: - cd flea - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message':' $COMMIT_MSG" + - echo "Commit message - $COMMIT_MSG" - | if echo "$COMMIT_MSG" | grep -q "deploy_only:"; then echo "✅ deploy_only detected, proceeding..." From af9d023b20896017a2c6ec451193d3cfff1c26ff Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 15:49:07 +0400 Subject: [PATCH 4/8] cicd fix. --- .drone.yml | 542 +---------------------------------------------------- 1 file changed, 1 insertion(+), 541 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0972571..019b255 100644 --- a/.drone.yml +++ b/.drone.yml @@ -93,544 +93,4 @@ steps: - echo "✅ Tests completed" depends_on: - dotnet-build - - docker - ---- -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# 📝 Pipeline 2: Main Branch Validation -# Trigger: Push to main branch -# Purpose: Validate main branch after merge -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -kind: pipeline -type: kubernetes -name: main-validation - -metadata: - namespace: musk-drone - -trigger: - ref: - - refs/heads/main - event: - - push - -clone: - disable: true - -services: - - name: docker - image: docker:27-dind - privileged: true - volumes: - - name: dockersock - path: /var/run - -volumes: - - name: dockersock - temp: {} - - name: nuget-cache - temp: {} - -steps: - - name: clone - image: alpine/git - commands: - - git clone https://gitea.musk.fun/nocr/flea - - cd flea - - git checkout $DRONE_COMMIT - - git submodule update --init --recursive - - - name: dotnet-restore - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - commands: - - cd flea - - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - - dotnet restore telegram-listener/Nocr.TelegramListener.sln - - dotnet restore telegram-client/Nocr.TelegramClient.sln - - dotnet restore text-matcher/Nocr.TextMatcher.sln - - dotnet restore users/Nocr.Users.sln - depends_on: - - clone - - - name: dotnet-build - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - commands: - - cd flea - - dotnet build telegram-listener/Nocr.TelegramListener.sln --no-restore -c Release - - dotnet build telegram-client/Nocr.TelegramClient.sln --no-restore -c Release - - dotnet build text-matcher/Nocr.TextMatcher.sln --no-restore -c Release - - dotnet build users/Nocr.Users.sln --no-restore -c Release - depends_on: - - dotnet-restore - - - name: dotnet-test - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - - name: dockersock - path: /var/run - environment: - DOCKER_HOST: unix:///var/run/docker.sock - commands: - - cd flea - - dotnet test text-matcher/Nocr.TextMatcher.sln --no-build -c Release --logger trx --results-directory ./test-results - depends_on: - - dotnet-build - - docker - ---- -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# 📦 Pipeline 3: Contracts-Only Publish -# Trigger: Tag with commit message containing "contracts_only:" -# Purpose: Fast publish of contract packages without building images -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -kind: pipeline -type: kubernetes -name: contracts-publish - -metadata: - namespace: musk-drone - -trigger: - ref: - - refs/tags/* - event: - - tag - -clone: - disable: true - -volumes: - - name: nuget-cache - temp: {} - -steps: - - name: clone - image: alpine/git - commands: - - git clone https://gitea.musk.fun/nocr/flea - - cd flea - - git checkout $DRONE_TAG - - git submodule update --init --recursive - - - name: check-trigger - image: alpine/git - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message - $COMMIT_MSG" - - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:"; then - echo "✅ contracts_only detected, proceeding..." - exit 0 - else - echo "⏭️ No contracts_only marker, skipping..." - exit 78 - fi - depends_on: - - clone - - - name: telegram-listener-contracts - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:telegram_listener"; then - echo "📦 Publishing telegram-listener contracts..." - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - dotnet pack telegram-listener/Nocr.TelegramListener.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - else - echo "⏭️ Skipping telegram-listener contracts" - fi - depends_on: - - check-trigger - - - name: text-matcher-contracts - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:text_matcher"; then - echo "📦 Publishing text-matcher contracts..." - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - dotnet pack text-matcher/Nocr.TextMatcher.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - else - echo "⏭️ Skipping text-matcher contracts" - fi - depends_on: - - check-trigger - - - name: users-contracts - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - | - if echo "$COMMIT_MSG" | grep -q "contracts_only:users"; then - echo "📦 Publishing users contracts..." - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - dotnet pack users/Nocr.Users.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - else - echo "⏭️ Skipping users contracts" - fi - depends_on: - - check-trigger - ---- -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# 🚀 Pipeline 4: Full Release -# Trigger: Tag on main branch WITHOUT "contracts_only" or "deploy_only" -# Purpose: Full release cycle - contracts → images → optional deploy -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -kind: pipeline -type: kubernetes -name: full-release - -metadata: - namespace: musk-drone - -trigger: - ref: - - refs/tags/* - event: - - tag - branch: - - main - -clone: - disable: true - -volumes: - - name: nuget-cache - temp: {} - -steps: - - name: clone - image: alpine/git - commands: - - git clone https://gitea.musk.fun/nocr/flea - - cd flea - - git checkout $DRONE_TAG - - git submodule update --init --recursive - - - name: check-trigger - image: alpine/git - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message - $COMMIT_MSG" - - | - if echo "$COMMIT_MSG" | grep -qE "contracts_only:|deploy_only:"; then - echo "⏭️ contracts_only or deploy_only detected, skipping full release..." - exit 78 - else - echo "✅ Full release triggered" - exit 0 - fi - depends_on: - - clone - - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - # STAGE 1: Publish NuGet Contracts (parallel) - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - name: telegram-listener-nuget - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - - dotnet pack telegram-listener/Nocr.TelegramListener.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - depends_on: - - check-trigger - - - name: text-matcher-nuget - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - - dotnet pack text-matcher/Nocr.TextMatcher.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - depends_on: - - check-trigger - - - name: users-nuget - image: mcr.microsoft.com/dotnet/sdk:8.0 - volumes: - - name: nuget-cache - path: /root/.nuget/packages - environment: - NUGETAPIKEY: - from_secret: nuget_musk_api_key - commands: - - cd flea - - dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json - - dotnet pack users/Nocr.Users.sln -o ./bin -p:PackageVersion=${DRONE_TAG} - - dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate - depends_on: - - check-trigger - - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - # STAGE 2: Build Docker Images with Kaniko (3 parallel streams) - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - 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:${DRONE_TAG} - --destination=hub.musk.fun/k8s/nocr/telegram_listener:latest - --cache=true - --cache-repo=hub.musk.fun/k8s/cache/nocr-telegram-listener - --compressed-caching=true - depends_on: - - telegram-listener-nuget - - text-matcher-nuget - - users-nuget - - - 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:${DRONE_TAG} - --destination=hub.musk.fun/k8s/nocr/telegram_client:latest - --cache=true - --cache-repo=hub.musk.fun/k8s/cache/nocr-telegram-client - --compressed-caching=true - depends_on: - - telegram-listener-build-push - - - 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:${DRONE_TAG} - --destination=hub.musk.fun/k8s/nocr/text_matcher:latest - --cache=true - --cache-repo=hub.musk.fun/k8s/cache/nocr-text-matcher - --compressed-caching=true - depends_on: - - telegram-listener-nuget - - text-matcher-nuget - - users-nuget - - - 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:${DRONE_TAG} - --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 - depends_on: - - text-matcher-build-push - - - 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:${DRONE_TAG} - --destination=hub.musk.fun/k8s/nocr/users:latest - --cache=true - --cache-repo=hub.musk.fun/k8s/cache/nocr-users - --compressed-caching=true - depends_on: - - telegram-listener-nuget - - text-matcher-nuget - - users-nuget - - - 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:${DRONE_TAG} - --destination=hub.musk.fun/k8s/nocr/users_migrator:latest - --cache=true - --cache-repo=hub.musk.fun/k8s/cache/nocr-users-migrator - --compressed-caching=true - depends_on: - - users-build-push - - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - # STAGE 3: Deploy to Kubernetes (optional, based on tag pattern) - # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - name: deploy-to-k8s - image: bitnami/kubectl:latest - commands: - - cd flea/_deploy/scripts - - chmod +x deploy.sh - - ./deploy.sh ${DRONE_TAG} ${DRONE_COMMIT_SHA:0:7} - depends_on: - - telegram-client-build-push - - text-matcher-migrator-build-push - - users-migrator-build-push - when: - ref: - - refs/tags/v* - ---- -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# 🚀 Pipeline 5: Deploy-Only -# Trigger: Tag with commit message containing "deploy_only:" -# Purpose: Fast deploy of already-built images -# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -kind: pipeline -type: kubernetes -name: deploy-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 checkout $DRONE_TAG - - git submodule update --init --recursive - - - name: check-trigger - image: alpine/git - commands: - - cd flea - - COMMIT_MSG=$(git log -1 --pretty=%B) - - echo "Commit message - $COMMIT_MSG" - - | - if echo "$COMMIT_MSG" | grep -q "deploy_only:"; then - echo "✅ deploy_only detected, proceeding..." - exit 0 - else - echo "⏭️ No deploy_only marker, skipping..." - exit 78 - fi - depends_on: - - clone - - - name: deploy - image: bitnami/kubectl:latest - commands: - - cd flea/_deploy/scripts - - chmod +x deploy.sh - - ./deploy.sh ${DRONE_TAG} ${DRONE_COMMIT_SHA:0:7} - depends_on: - - check-trigger + - docker \ No newline at end of file From b0882f62d2b09f18184db9574a88f855755ba7bc Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 15:59:16 +0400 Subject: [PATCH 5/8] Fixed build --- telegram-client | 2 +- telegram-listener | 2 +- text-matcher | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-client b/telegram-client index ccd1c31..0277bfa 160000 --- a/telegram-client +++ b/telegram-client @@ -1 +1 @@ -Subproject commit ccd1c31f1d99afdc028fdc8ba8676de742f43926 +Subproject commit 0277bfa94c7ca496ce03fa02ee5fd3c6b674ed90 diff --git a/telegram-listener b/telegram-listener index 3802eb9..b152628 160000 --- a/telegram-listener +++ b/telegram-listener @@ -1 +1 @@ -Subproject commit 3802eb9dd6a428041c02c947034942973faa0560 +Subproject commit b1526283f7c87698874a6ce0931483f75ca7a1bd diff --git a/text-matcher b/text-matcher index f3df86c..fc779d5 160000 --- a/text-matcher +++ b/text-matcher @@ -1 +1 @@ -Subproject commit f3df86c90ae3bc62ab55aac694b37c5a751b7c68 +Subproject commit fc779d581c15cdab698e490ae4d7576e608f1057 From 0f9ee08779cc022055dedbdf02afcdd0d392634e Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 16:09:51 +0400 Subject: [PATCH 6/8] build fix. --- telegram-client | 2 +- telegram-listener | 2 +- text-matcher | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-client b/telegram-client index 0277bfa..75c125b 160000 --- a/telegram-client +++ b/telegram-client @@ -1 +1 @@ -Subproject commit 0277bfa94c7ca496ce03fa02ee5fd3c6b674ed90 +Subproject commit 75c125b582867fbadd86a3885fd9455d8f459dac diff --git a/telegram-listener b/telegram-listener index b152628..e461387 160000 --- a/telegram-listener +++ b/telegram-listener @@ -1 +1 @@ -Subproject commit b1526283f7c87698874a6ce0931483f75ca7a1bd +Subproject commit e461387ae38630554fde5bcd496e21d5334805f2 diff --git a/text-matcher b/text-matcher index fc779d5..c4b338e 160000 --- a/text-matcher +++ b/text-matcher @@ -1 +1 @@ -Subproject commit fc779d581c15cdab698e490ae4d7576e608f1057 +Subproject commit c4b338e727865f1bf22d2e1b732e22b76af29fb7 From 0c467239b99159833bf67c81b17f4d489113c51f Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 16:46:31 +0400 Subject: [PATCH 7/8] fix deps --- telegram-client | 2 +- telegram-listener | 2 +- text-matcher | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-client b/telegram-client index 75c125b..70e58ef 160000 --- a/telegram-client +++ b/telegram-client @@ -1 +1 @@ -Subproject commit 75c125b582867fbadd86a3885fd9455d8f459dac +Subproject commit 70e58ef0285c0f866ef07fb62556ab135dec4b85 diff --git a/telegram-listener b/telegram-listener index e461387..b92f4c0 160000 --- a/telegram-listener +++ b/telegram-listener @@ -1 +1 @@ -Subproject commit e461387ae38630554fde5bcd496e21d5334805f2 +Subproject commit b92f4c00d56d05730509b4d7f452bc7c25c189ac diff --git a/text-matcher b/text-matcher index c4b338e..ed1c7f2 160000 --- a/text-matcher +++ b/text-matcher @@ -1 +1 @@ -Subproject commit c4b338e727865f1bf22d2e1b732e22b76af29fb7 +Subproject commit ed1c7f249e5750a54c7050b8b41132cfe6fa4e24 From 793266b8164717a653b81a299d6effcaa1beb3a9 Mon Sep 17 00:00:00 2001 From: ruberoid Date: Thu, 16 Oct 2025 16:54:32 +0400 Subject: [PATCH 8/8] fix deps --- telegram-client | 2 +- telegram-listener | 2 +- text-matcher | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-client b/telegram-client index 70e58ef..b754ae1 160000 --- a/telegram-client +++ b/telegram-client @@ -1 +1 @@ -Subproject commit 70e58ef0285c0f866ef07fb62556ab135dec4b85 +Subproject commit b754ae1c5b50feb757237c2036e0e25432cdd1e3 diff --git a/telegram-listener b/telegram-listener index b92f4c0..7030e7b 160000 --- a/telegram-listener +++ b/telegram-listener @@ -1 +1 @@ -Subproject commit b92f4c00d56d05730509b4d7f452bc7c25c189ac +Subproject commit 7030e7bce2004ea342ceedf9eb5126077e267b72 diff --git a/text-matcher b/text-matcher index ed1c7f2..e0b6bea 160000 --- a/text-matcher +++ b/text-matcher @@ -1 +1 @@ -Subproject commit ed1c7f249e5750a54c7050b8b41132cfe6fa4e24 +Subproject commit e0b6beab7e6ccdf3d89b56d07abef3b619cbfa32