109 lines
2.4 KiB
YAML
109 lines
2.4 KiB
YAML
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: build
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: git clone
|
|
image: drone/git
|
|
environment:
|
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
|
commands:
|
|
- git clone $REPO_URL .
|
|
- git checkout $DRONE_COMMIT
|
|
|
|
- name: dotnet restore
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet restore
|
|
|
|
- name: dotnet build
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet build --configuration Release
|
|
- ls ./SampleApi/bin/Release/net8.0/
|
|
|
|
- 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
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: git clone
|
|
image: drone/git
|
|
environment:
|
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
|
commands:
|
|
- git clone $REPO_URL .
|
|
- git checkout $DRONE_COMMIT
|
|
|
|
- name: dotnet publish
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet publish --configuration Release
|
|
- ls ./SampleApi/bin/Release/net8.0/publish/
|
|
|
|
- name: docker build and push
|
|
image: plugins/docker
|
|
settings:
|
|
repo: registry-server.registry.svc.cluster.local:5000/sampleapi
|
|
auto_tag: true
|
|
registry: registry-server.registry.svc.cluster.local:5000
|
|
insecure: true
|
|
username:
|
|
from_secret: registry-username
|
|
password:
|
|
from_secret: registry-password
|
|
dockerfile: Dockerfile
|
|
context: ./SampleApi/bin/Release/net8.0/publish/
|
|
|
|
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: deploy
|
|
|
|
depends_on:
|
|
- package
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: git clone
|
|
image: drone/git
|
|
environment:
|
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
|
commands:
|
|
- git clone $REPO_URL .
|
|
- git checkout $DRONE_COMMIT
|
|
|
|
- name: ensure namespace
|
|
image: bitnami/kubectl:latest
|
|
commands:
|
|
- kubectl create namespace sampleapi --dry-run=client -o yaml | kubectl apply -f -
|
|
|
|
- name: deploy
|
|
image: danielgormly/drone-plugin-kube:0.0.1
|
|
settings:
|
|
template: ./manifests/deploy.yml
|
|
namespace: sampleapi
|
|
ca:
|
|
from_secret: kube_ca_cert
|
|
server: https://lead:6443
|
|
token:
|
|
from_secret: k8s-token
|