Fixed yaml code paste error
This commit is contained in:
51
.drone.yml
51
.drone.yml
@@ -4,17 +4,9 @@ type: kubernetes
|
|||||||
name: build
|
name: build
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: false
|
||||||
|
|
||||||
steps:
|
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
|
- name: dotnet restore
|
||||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||||
commands:
|
commands:
|
||||||
@@ -30,7 +22,6 @@ steps:
|
|||||||
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
|
||||||
@@ -43,14 +34,6 @@ clone:
|
|||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
steps:
|
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
|
- name: dotnet publish
|
||||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||||
commands:
|
commands:
|
||||||
@@ -70,7 +53,6 @@ steps:
|
|||||||
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
|
||||||
@@ -83,22 +65,17 @@ clone:
|
|||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: git clone
|
- name: deploy via SSH
|
||||||
image: drone/git
|
image: appleboy/drone-ssh
|
||||||
environment:
|
|
||||||
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
|
|
||||||
commands:
|
|
||||||
- git clone $REPO_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
|
|
||||||
- name: deploy
|
|
||||||
image: danielgormly/drone-plugin-kube:0.0.1
|
|
||||||
settings:
|
settings:
|
||||||
serviceAccountName: droneci-sa
|
host: lead.mngoma.lab
|
||||||
template: ./manifests/deploy.yml
|
username:
|
||||||
namespace: sampleapi
|
from_secret: host-username
|
||||||
ca:
|
password:
|
||||||
from_secret: k8s-cert
|
from_secret: host-password
|
||||||
server: https://lead.mngoma.lab:6443
|
port: 22
|
||||||
token:
|
script:
|
||||||
from_secret: k8s-token
|
- set -euo pipefail
|
||||||
|
- echo "Applying Kubernetes manifest via SSH..."
|
||||||
|
- cat ./manifests/deploy.yml | kubectl apply -f -
|
||||||
|
- echo "Manifest applied successfully."
|
||||||
|
|||||||
@@ -1,81 +1,99 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
apiVersion: v1
|
||||||
type: kubernetes
|
kind: Namespace
|
||||||
name: build
|
metadata:
|
||||||
|
name: experiments
|
||||||
clone:
|
labels:
|
||||||
disable: false
|
name: experiments
|
||||||
|
|
||||||
steps:
|
|
||||||
- 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
|
apiVersion: v1
|
||||||
type: kubernetes
|
kind: ConfigMap
|
||||||
name: package
|
metadata:
|
||||||
|
name: sampleapi-config
|
||||||
depends_on:
|
namespace: experiments
|
||||||
- build
|
data:
|
||||||
|
appname: "SampleApi"
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- 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
|
apiVersion: apps/v1
|
||||||
type: kubernetes
|
kind: Deployment
|
||||||
name: deploy
|
metadata:
|
||||||
|
name: sampleapi
|
||||||
depends_on:
|
namespace: experiments
|
||||||
- package
|
labels:
|
||||||
|
app: sampleapi
|
||||||
clone:
|
spec:
|
||||||
disable: true
|
replicas: 1
|
||||||
|
selector:
|
||||||
steps:
|
matchLabels:
|
||||||
- name: deploy via SSH
|
app: sampleapi
|
||||||
image: appleboy/drone-ssh
|
template:
|
||||||
settings:
|
metadata:
|
||||||
host: lead.mngoma.lab
|
labels:
|
||||||
username:
|
app: sampleapi
|
||||||
from_secret: host-username
|
spec:
|
||||||
password:
|
containers:
|
||||||
from_secret: host-password
|
- name: sampleapi
|
||||||
port: 22
|
image: registry.registry.svc.cluster.local:5000/experiments/sampleapi:latest
|
||||||
script:
|
imagePullPolicy: Always
|
||||||
- set -euo pipefail
|
ports:
|
||||||
- echo "Applying Kubernetes manifest via SSH..."
|
- name: http
|
||||||
- cat ./manifests/deploy.yml | kubectl apply -f -
|
containerPort: 8080
|
||||||
- echo "Manifest applied successfully."
|
- name: https
|
||||||
|
containerPort: 8081
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "250m"
|
||||||
|
limits:
|
||||||
|
memory: "256Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
---
|
||||||
|
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