Light refactor
This commit is contained in:
132
.drone.yml
132
.drone.yml
@@ -7,36 +7,35 @@ clone:
|
|||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# git clone code base
|
- name: git clone
|
||||||
- name: git clone
|
image: drone/git
|
||||||
image: drone/git
|
environment:
|
||||||
commands:
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
||||||
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git .
|
commands:
|
||||||
- git checkout $DRONE_COMMIT
|
- git clone $REPO_URL .
|
||||||
|
- 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
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: package
|
name: package
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build
|
- build
|
||||||
|
|
||||||
@@ -44,39 +43,37 @@ clone:
|
|||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# git clone code base
|
- name: git clone
|
||||||
- name: git clone
|
image: drone/git
|
||||||
image: drone/git
|
environment:
|
||||||
settings:
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
||||||
skip_verify: true
|
commands:
|
||||||
commands:
|
- git clone $REPO_URL .
|
||||||
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git .
|
- 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/sampleapi
|
||||||
repo: registry-server.registry.svc.cluster.local:5000/experiments/sampleapi
|
auto_tag: true
|
||||||
auto_tag: true
|
username:
|
||||||
username:
|
from_secret: registry-username
|
||||||
from_secret: registry-username
|
password:
|
||||||
password:
|
from_secret: registry-password
|
||||||
from_secret: registry-password
|
dockerfile: Dockerfile
|
||||||
dockerfile: Dockerfile
|
context: ./SampleApi/bin/Release/net8.0/publish/
|
||||||
context: ./SampleApi/bin/Release/net8.0/publish/
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: deploy
|
name: deploy
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- package
|
- package
|
||||||
|
|
||||||
@@ -84,21 +81,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:
|
||||||
settings:
|
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
||||||
skip_verify: true
|
commands:
|
||||||
commands:
|
- git clone $REPO_URL .
|
||||||
- git clone http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git .
|
- git checkout $DRONE_COMMIT
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
|
|
||||||
- name: deploy
|
- name: ensure namespace
|
||||||
image: danielgormly/drone-plugin-kube:0.0.1
|
image: bitnami/kubectl:latest
|
||||||
settings:
|
commands:
|
||||||
template: ./manifests/deploy.yml
|
- kubectl create namespace sampleapi --dry-run=client -o yaml | kubectl apply -f -
|
||||||
ca:
|
|
||||||
from_secret: kube_ca_cert
|
- name: deploy
|
||||||
server: https://lead:6443
|
image: danielgormly/drone-plugin-kube:0.0.1
|
||||||
token:
|
settings:
|
||||||
from_secret: k8s-token
|
template: ./manifests/deploy.yml
|
||||||
|
namespace: sampleapi
|
||||||
|
ca:
|
||||||
|
from_secret: kube_ca_cert
|
||||||
|
server: https://lead:6443
|
||||||
|
token:
|
||||||
|
from_secret: k8s-token
|
||||||
|
|||||||
Reference in New Issue
Block a user