Merge pull request 'Refactored pipeline to separate build and test, package and deploy promostion stages' (#43) from test into main
Some checks failed
continuous-integration/drone Build was killed

Reviewed-on: #43
This commit was merged in pull request #43.
This commit is contained in:
2026-03-08 12:34:57 +02:00

View File

@@ -1,3 +1,29 @@
---
kind: pipeline
type: docker
name: build and test
clone:
disable: true
steps:
- name: checkout
image: alpine/git
commands:
- git clone https://gitea.khongisa.co.za/MngomaLab/webapitest.git .
- git checkout ${DRONE_COMMIT}
- name: dotnet build
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet build --configuration Release
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet test --configuration Release
---
x-docker-auth: &docker-auth
DOCKER_AUTH_CONFIG: |
{
@@ -39,4 +65,53 @@ steps:
--context=.
--dockerfile=Dockerfile
--destination=index.docker.io/khwezi/webapitest:latest
--destination=index.docker.io/khwezi/webapitest:${DRONE_BUILD_NUMBER}
--destination=index.docker.io/khwezi/webapitest:${DRONE_BUILD_NUMBER}
---
kind: pipeline
type: docker
name: deploy
clone:
disable: true
steps:
- name: uat
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user
key:
from_secret: ssh_key
script:
- docker pull khwezi/webapitest:latest
- docker stop webapitest || true
- docker rm webapitest || true
- docker run -d --name webapitest -p 4000:80 khwezi/webapitest:latest
when:
event:
- promote
target:
- uat
- name: prod
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user
key:
from_secret: ssh_key
script:
- docker pull khwezi/webapitest:latest
- docker stop webapi || true
- docker rm webapi || true
- docker run -d --name webapi -p 4001:80 khwezi/webapitest:latest
when:
event:
- promote
target:
- prod