Light refactor

This commit is contained in:
Khwezi
2025-10-12 14:43:23 +02:00
parent d29e73b0d6
commit 02d1539a87

View File

@@ -7,28 +7,26 @@ clone:
disable: true disable: true
steps: steps:
# git clone code base - name: git clone
- name: git clone
image: drone/git image: drone/git
environment:
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands: commands:
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git . - git clone $REPO_URL .
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
# dotnet restore - name: dotnet restore
- name: dotnet restore
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
commands: commands:
- dotnet restore - dotnet restore
# dotnet build - name: dotnet build
- name: dotnet build
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
commands: commands:
- dotnet build --configuration Release - dotnet build --configuration Release
- ls ./SampleApi/bin/Release/net8.0/ - ls ./SampleApi/bin/Release/net8.0/
# dotnet test - name: dotnet test
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
commands: commands:
- dotnet test --configuration Release - dotnet test --configuration Release
@@ -37,6 +35,7 @@ steps:
kind: pipeline kind: pipeline
type: kubernetes type: kubernetes
name: package name: package
depends_on: depends_on:
- build - build
@@ -44,27 +43,24 @@ clone:
disable: true disable: true
steps: steps:
# git clone code base - name: git clone
- name: git clone
image: drone/git image: drone/git
settings: environment:
skip_verify: true REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands: commands:
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git . - git clone $REPO_URL .
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
# dotnet publish - name: dotnet publish
- name: dotnet publish
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:8.0
commands: commands:
- dotnet publish --configuration Release - dotnet publish --configuration Release
- ls ./SampleApi/bin/Release/net8.0/publish/ - ls ./SampleApi/bin/Release/net8.0/publish/
# build and push docker image to in-cluster registry - name: docker build and push
- name: docker build and push
image: plugins/docker image: plugins/docker
settings: settings:
repo: registry-server.registry.svc.cluster.local:5000/experiments/sampleapi repo: registry-server.registry.svc.cluster.local:5000/sampleapi
auto_tag: true auto_tag: true
username: username:
from_secret: registry-username from_secret: registry-username
@@ -77,6 +73,7 @@ steps:
kind: pipeline kind: pipeline
type: kubernetes type: kubernetes
name: deploy name: deploy
depends_on: depends_on:
- package - package
@@ -84,19 +81,24 @@ clone:
disable: true disable: true
steps: steps:
# git clone code base - name: git clone
- name: git clone
image: drone/git image: drone/git
settings: environment:
skip_verify: true REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands: commands:
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git . - git clone $REPO_URL .
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
- name: deploy - 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 image: danielgormly/drone-plugin-kube:0.0.1
settings: settings:
template: ./manifests/deploy.yml template: ./manifests/deploy.yml
namespace: sampleapi
ca: ca:
from_secret: kube_ca_cert from_secret: kube_ca_cert
server: https://lead:6443 server: https://lead:6443