Refactored test pipeline and manifest to fit new cluster

This commit is contained in:
Khwezi
2025-10-12 13:26:24 +02:00
parent dbb5fc3801
commit c2ecb79adb
3 changed files with 116 additions and 25 deletions

View File

@@ -3,7 +3,6 @@ kind: pipeline
type: kubernetes
name: build
# disable built-in clone step
clone:
disable: true
@@ -12,35 +11,35 @@ steps:
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
# dotnet restore
- name: dotnet restore
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet restore
- dotnet restore
# dotnet build
- name: dotnet build
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet build --configuration Release
- ls ./SampleApi/bin/Release/net8.0/
- dotnet build --configuration Release
- ls ./SampleApi/bin/Release/net8.0/
# dotnet test
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet test --configuration Release
- dotnet test --configuration Release
---
kind: pipeline
type: kubernetes
name: package
depends_on:
- build
- build
# disable built-in clone step
clone:
disable: true
@@ -49,36 +48,36 @@ steps:
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
# dotnet publish
- name: dotnet publish
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet publish --configuration Release
- ls ./SampleApi/bin/Release/net8.0/publish/
- dotnet publish --configuration Release
- ls ./SampleApi/bin/Release/net8.0/publish/
# build and push docker image
# build and push docker image to in-cluster registry
- name: docker build and push
image: plugins/docker
settings:
repo: khwezi/mngomalab
repo: registry.registry.svc.cluster.local:5000/experiments/sampleapi
auto_tag: true
username:
from_secret: docker_username
from_secret: registry-username
password:
from_secret: docker_password
from_secret: registry-password
dockerfile: Dockerfile
context: ./SampleApi/bin/Release/net8.0/publish/
---
kind: pipeline
type: kubernetes
name: deploy
depends_on:
- package
- package
# disable built-in clone step
clone:
disable: true
@@ -87,15 +86,15 @@ steps:
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
- name: deploy
image: danielgormly/drone-plugin-kube:0.0.1
settings:
template: ./templates/deployment.yaml
ca:
template: ./manifests/deploy-app.yml
ca:
from_secret: kube_ca_cert
server: https://192.168.1.161:6443
server: https://lead:6443
token:
from_secret: k3s_token
from_secret: k3s_token