flea/.drone.yml
ruberoid cdd31d3c5b
Some checks failed
continuous-integration/drone/tag Build is failing
Test: replace plugins/docker with docker:dind for telegram-listener
2025-10-14 19:04:56 +04:00

243 lines
8.1 KiB
YAML

---
kind: pipeline
type: kubernetes
name: Nocr
metadata:
namespace: musk-drone
trigger:
ref:
- refs/tags/*
# - refs/heads/main
clone:
disable: true
steps:
- name: debug
image: alpine
commands:
- printenv
- name: clone
image: alpine/git
settings:
tags: true
commands:
- pwd
- git clone https://gitea.musk.fun/nocr/flea
- cd flea
- git submodule update --init --recursive
- name: debug-network
image: alpine
commands:
- apk add --no-cache bind-tools curl ca-certificates
- echo "=== System Info ==="
- cat /etc/os-release
- echo ""
- echo "=== DNS Configuration ==="
- cat /etc/resolv.conf
- echo ""
- echo "=== DNS Resolution Test ==="
- nslookup api.nuget.org || echo "DNS lookup failed"
- nslookup gitea.musk.fun || echo "DNS lookup failed for gitea"
- echo ""
- echo "=== Ping Test (NuGet) ==="
- ping -c 3 api.nuget.org || echo "Ping failed"
- echo ""
- echo "=== HTTPS Connection Test (NuGet) ==="
- curl -v --connect-timeout 10 --max-time 30 https://api.nuget.org/v3/index.json 2>&1 | head -50
- echo ""
- echo "=== HTTPS Connection Test (Gitea) ==="
- curl -v --connect-timeout 10 --max-time 30 https://gitea.musk.fun 2>&1 | head -30
- echo ""
- echo "=== CA Certificates Check ==="
- ls -lah /etc/ssl/certs/ | head -20
depends_on:
- clone
- name: debug-dotnet-restore
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- echo "=== .NET SDK Info ==="
- dotnet --info
- echo ""
- echo "=== CA Certificates Update ==="
- apt-get update && apt-get install -y --no-install-recommends ca-certificates
- update-ca-certificates
- echo ""
- echo "=== Test NuGet Connection ==="
- dotnet nuget list source
- echo ""
- echo "=== Test Restore with Simple Project ==="
- mkdir -p /tmp/test && cd /tmp/test
- dotnet new console
- echo "Adding package reference..."
- dotnet add package Newtonsoft.Json --version 13.0.3
- echo "Testing restore..."
- dotnet restore --verbosity detailed 2>&1 | tail -100
depends_on:
- debug-network
# TEST: Using docker:dind instead of plugins/docker to isolate hanging issue
- name: docker nocr telegram listener build & push
image: docker:24-dind
environment:
HUB_USERNAME:
from_secret: hub_username
HUB_PASSWORD:
from_secret: hub_password
volumes:
- name: dockersock
path: /var/run
commands:
- echo "=== Docker version ==="
- docker version || echo "Docker not available yet, starting daemon..."
- dockerd --host=unix:///var/run/docker.sock --tls=false &
- sleep 5
- docker version
- echo ""
- echo "=== Logging into registry ==="
- echo "$HUB_PASSWORD" | docker login hub.musk.fun -u "$HUB_USERNAME" --password-stdin
- echo ""
- echo "=== Building image ==="
- cd flea/telegram-listener
- docker build --no-cache -f src/Nocr.TelegramListener.Host/Dockerfile -t hub.musk.fun/k8s/nocr/telegram_listener:${DRONE_COMMIT_SHA:0:7} -t hub.musk.fun/k8s/nocr/telegram_listener:latest .
- echo ""
- echo "=== Pushing image ==="
- docker push hub.musk.fun/k8s/nocr/telegram_listener:${DRONE_COMMIT_SHA:0:7}
- docker push hub.musk.fun/k8s/nocr/telegram_listener:latest
- echo "=== Done ==="
depends_on:
- debug-dotnet-restore
- name: docker nocr text matcher build & push
image: plugins/docker
settings:
registry: hub.musk.fun
repo: hub.musk.fun/k8s/nocr/text_matcher
tags: ["${DRONE_COMMIT_SHA:0:7}", "latest"]
context: ./flea/text-matcher
dockerfile: ./flea/text-matcher/src/Nocr.TextMatcher.Host/Dockerfile
username:
from_secret: hub_username
password:
from_secret: hub_password
# TEMPORARY: Disable cache to force fresh certificate update
no_cache: true
depends_on:
- docker nocr telegram listener build & push
- name: docker nocr users build & push
image: plugins/docker
settings:
registry: hub.musk.fun
repo: hub.musk.fun/k8s/nocr/users
tags: ["${DRONE_COMMIT_SHA:0:7}", "latest"]
context: ./flea/users
dockerfile: ./flea/users/src/Nocr.Users.Host/Dockerfile
username:
from_secret: hub_username
password:
from_secret: hub_password
# TEMPORARY: Disable cache to force fresh certificate update
no_cache: true
depends_on:
- docker nocr text matcher build & push
- name: docker nocr telegram client build & push
image: plugins/docker
settings:
registry: hub.musk.fun
repo: hub.musk.fun/k8s/nocr/telegram_client
tags: ["${DRONE_COMMIT_SHA:0:7}", "latest"]
context: ./flea/telegram-client
dockerfile: ./flea/telegram-client/src/Nocr.TelegramClient.Host/Dockerfile
username:
from_secret: hub_username
password:
from_secret: hub_password
# TEMPORARY: Disable cache to force fresh certificate update
no_cache: true
depends_on:
- docker nocr users build & push
- name: docker nocr text matcher migrator build & push
image: plugins/docker
settings:
registry: hub.musk.fun
repo: hub.musk.fun/k8s/nocr/text_matcher_migrator
tags: ["${DRONE_COMMIT_SHA:0:7}", "latest"]
context: ./flea/text-matcher/
dockerfile: ./flea/text-matcher/src/Nocr.TextMatcher.Migrator/Dockerfile
username:
from_secret: hub_username
password:
from_secret: hub_password
# TEMPORARY: Disable cache to force fresh certificate update
no_cache: true
depends_on:
- docker nocr telegram client build & push
- name: docker nocr users migrator build & push
image: plugins/docker
settings:
registry: hub.musk.fun
repo: hub.musk.fun/k8s/nocr/users_migrator
tags: ["${DRONE_COMMIT_SHA:0:7}", "latest"]
context: ./flea/users/
dockerfile: ./flea/users/src/Nocr.Users.Migrator/Dockerfile
username:
from_secret: hub_username
password:
from_secret: hub_password
# TEMPORARY: Disable cache to force fresh certificate update
no_cache: true
depends_on:
- docker nocr text matcher migrator build & push
- name: nocr telegram listener nuget package make & push
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:
- docker nocr users migrator build & push
- name: nocr text matcher nuget package make & push
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:
- nocr telegram listener nuget package make & push
- name: nocr users nuget package make & push
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:
- nocr text matcher nuget package make & push
volumes:
- name: dockersock
temp: {}