Files
cluster/sampleapi/.drone.yml
Khwezi Mngoma 0410dc3950 first commit
2026-02-22 16:43:17 +02:00

101 lines
2.0 KiB
YAML

---
kind: pipeline
type: kubernetes
name: build
# disable built-in clone step
clone:
disable: true
steps:
# git clone code base
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
# dotnet restore
- name: dotnet restore
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- 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 test
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet test --configuration Release
---
kind: pipeline
type: kubernetes
name: package
depends_on:
- build
# disable built-in clone step
clone:
disable: true
steps:
# git clone code base
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/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/
# build and push docker image
- name: docker build and push
image: plugins/docker
settings:
repo: khwezi/mngomalab
auto_tag: true
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
context: ./SampleApi/bin/Release/net8.0/publish/
---
kind: pipeline
type: kubernetes
name: deploy
depends_on:
- package
# disable built-in clone step
clone:
disable: true
steps:
# git clone code base
- name: git clone
image: drone/git
commands:
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
- git checkout $DRONE_COMMIT
- name: deploy
image: danielgormly/drone-plugin-kube:0.0.1
settings:
template: ./templates/deployment.yaml
ca:
from_secret: kube_ca_cert
server: https://192.168.1.161:6443
token:
from_secret: k3s_token