Restructured pipeline to better use ssh for deployment
This commit is contained in:
@@ -4,17 +4,9 @@ type: kubernetes
|
||||
name: build
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
disable: false
|
||||
|
||||
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:
|
||||
@@ -30,7 +22,6 @@ steps:
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet test --configuration Release
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
@@ -43,14 +34,6 @@ 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:
|
||||
@@ -70,7 +53,6 @@ steps:
|
||||
from_secret: registry-password
|
||||
dockerfile: Dockerfile
|
||||
context: ./SampleApi/bin/Release/net8.0/publish/
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
@@ -93,10 +75,7 @@ steps:
|
||||
from_secret: host-password
|
||||
port: 22
|
||||
script:
|
||||
- |
|
||||
set -euo pipefail
|
||||
echo "Applying Kubernetes manifest via SSH..."
|
||||
ssh -o StrictHostKeyChecking=no $DRONE_REMOTE_USER@lead.mngoma.lab 'kubectl apply -f -' <<'EOF'
|
||||
$(cat ./manifests/deploy.yml)
|
||||
EOF
|
||||
echo "Manifest applied successfully."
|
||||
- set -euo pipefail
|
||||
- echo "Applying Kubernetes manifest via SSH..."
|
||||
- cat ./manifests/deploy.yml | kubectl apply -f -
|
||||
- echo "Manifest applied successfully."
|
||||
|
||||
Reference in New Issue
Block a user