Refactored test pipeline and manifest to fit new cluster
This commit is contained in:
49
.drone.yml
49
.drone.yml
@@ -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
|
||||
|
||||
92
manifests/deploy-app.yml
Normal file
92
manifests/deploy-app.yml
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: experiments
|
||||
labels:
|
||||
name: experiments
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: sampleapi-config
|
||||
namespace: experiments
|
||||
data:
|
||||
appname: "SampleApi"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sampleapi
|
||||
namespace: experiments
|
||||
labels:
|
||||
app: sampleapi
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sampleapi
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sampleapi
|
||||
spec:
|
||||
containers:
|
||||
- name: sampleapi
|
||||
image: registry.registry.svc.cluster.local:5000/experiments/sampleapi:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
- name: https
|
||||
containerPort: 8081
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sampleapi
|
||||
namespace: experiments
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: sampleapi
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
- name: https
|
||||
port: 443
|
||||
targetPort: 8081
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: sampleapi-http
|
||||
namespace: experiments
|
||||
spec:
|
||||
entryPoints:
|
||||
- web
|
||||
routes:
|
||||
- match: Host(`sampleapi.apps.mngoma.lab`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: sampleapi
|
||||
port: 80
|
||||
scheme: http
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: sampleapi-https
|
||||
namespace: experiments
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: Host(`sampleapi.apps.mngoma.lab`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: sampleapi
|
||||
port: 443
|
||||
scheme: http
|
||||
tls: {}
|
||||
Reference in New Issue
Block a user