Compare commits
66
Commits
test
..
900e72779f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
900e72779f | ||
|
|
28d02037f8 | ||
|
|
5e00dd6726 | ||
|
|
5ee124790f | ||
|
|
8b23dfa534 | ||
|
|
42361d94a8 | ||
|
|
5cc239854e | ||
|
|
3ce3d88fae | ||
|
|
71dd02a122 | ||
|
|
45c3c77bb3 | ||
|
|
0ea4a0829d | ||
|
|
467a385c2a | ||
|
|
06a910e894 | ||
|
|
2372a8a24a | ||
|
|
4eb185aece | ||
|
|
64ac839d3c | ||
|
|
c81a4451d6 | ||
|
|
9116076bac | ||
|
|
1a8e9abb3e | ||
|
|
09558ce984 | ||
|
|
a20c90039b | ||
|
|
da229bf4ec | ||
|
|
6bc8e5e703 | ||
|
|
8fce29f5ab | ||
|
|
79a3d87668 | ||
|
|
833bfafa7f | ||
|
|
2477602874 | ||
|
|
8afd460a3c | ||
|
|
10d9186f92 | ||
|
|
41538c6376 | ||
|
|
94ad00974d | ||
|
|
45171382f0 | ||
|
|
eb4884eab5 | ||
|
|
2b3bd2897c | ||
|
|
1831c79554 | ||
|
|
909b9e742a | ||
|
|
bec8ce3e74 | ||
|
|
6ee84199b2 | ||
|
|
895bce48d2 | ||
|
|
087358efc6 | ||
|
|
d828595384 | ||
|
|
8cff952b17 | ||
|
|
1af6ceb288 | ||
|
|
d801f96fb9 | ||
|
|
1cc3750fa3 | ||
|
|
e38dff6e92 | ||
|
|
c4b125a580 | ||
|
|
c9de909eb6 | ||
|
|
7eb870a29c | ||
|
|
83c7844880 | ||
|
|
69b92e9323 | ||
|
|
fcfd265c46 | ||
|
|
bc3a44d5ea | ||
|
|
cded235985 | ||
|
|
f15143349e | ||
|
|
7d8f15104c | ||
|
|
e2b5f2db8c | ||
|
|
57ba629d2d | ||
|
|
d30ee959ee | ||
|
|
4e653fd91d | ||
|
|
b4ee875ac8 | ||
|
|
7d395e2295 | ||
|
|
ddc66efc16 | ||
|
|
82348a0112 | ||
|
|
e495be1c0b | ||
|
|
5a530210c0 |
+1
-3
@@ -27,6 +27,4 @@ README.md
|
|||||||
!.git/config
|
!.git/config
|
||||||
!.git/packed-refs
|
!.git/packed-refs
|
||||||
!.git/refs/heads/**
|
!.git/refs/heads/**
|
||||||
# Ensure the build output is NOT ignored
|
|
||||||
!**/bin/Release/**/publish/
|
|
||||||
!**/publish/
|
|
||||||
|
|||||||
+123
-47
@@ -1,68 +1,144 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build-and-package
|
name: build
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build-test-publish
|
|
||||||
image: nexus.khongisa.co.za/sdk:10.0
|
|
||||||
commands:
|
|
||||||
- dotnet restore --source https://nexus.khongisa.co.za/repository/nuget-group/index.json --no-cache
|
|
||||||
- dotnet build --configuration Release --no-restore
|
|
||||||
- dotnet test --configuration Release --no-build
|
|
||||||
- dotnet publish --configuration Release --no-build
|
|
||||||
|
|
||||||
- name: docker-build-and-push
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: nexus.khongisa.co.za
|
|
||||||
repo: nexus.khongisa.co.za/webapitest
|
|
||||||
tags: [ "${DRONE_BUILD_NUMBER}", "latest" ]
|
|
||||||
username: { from_secret: docker_username }
|
|
||||||
password: { from_secret: docker_password }
|
|
||||||
|
|
||||||
- name: vulnerability-scan
|
|
||||||
image: aquasec/trivy:0.50.1
|
|
||||||
environment:
|
|
||||||
TRIVY_USERNAME: { from_secret: docker_username }
|
|
||||||
TRIVY_PASSWORD: { from_secret: docker_password }
|
|
||||||
commands:
|
|
||||||
- trivy image --image-src remote --exit-code 1 --severity CRITICAL nexus.khongisa.co.za/webapitest:${DRONE_BUILD_NUMBER}
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
event:
|
event:
|
||||||
exclude:
|
exclude:
|
||||||
- promote
|
- promote
|
||||||
|
|
||||||
|
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:10.0
|
||||||
|
commands:
|
||||||
|
- dotnet build --configuration Release
|
||||||
|
|
||||||
|
- name: dotnet test
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
|
commands:
|
||||||
|
- dotnet test --configuration Release
|
||||||
|
---
|
||||||
|
x-docker-auth: &docker-auth
|
||||||
|
DOCKER_AUTH_CONFIG: |
|
||||||
|
{
|
||||||
|
"auths": {
|
||||||
|
"https://index.docker.io/v1/": {
|
||||||
|
"auth": "a2h3ZXppOlBHM0FRM0VPMFg="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: package
|
||||||
|
depends_on:
|
||||||
|
- build
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- promote
|
||||||
|
|
||||||
|
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 publish
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
|
commands:
|
||||||
|
- dotnet publish --configuration Release
|
||||||
|
|
||||||
|
|
||||||
|
- name: build and push
|
||||||
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
|
environment:
|
||||||
|
<<: *docker-auth
|
||||||
|
commands:
|
||||||
|
- mkdir -p /kaniko/.docker
|
||||||
|
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
|
||||||
|
- /kaniko/executor
|
||||||
|
--verbosity=debug
|
||||||
|
--context=.
|
||||||
|
--dockerfile=Dockerfile
|
||||||
|
--destination=index.docker.io/khwezi/webapitest:latest
|
||||||
|
--destination=index.docker.io/khwezi/webapitest:${DRONE_BUILD_NUMBER}
|
||||||
|
|
||||||
|
- name: volnerability scan
|
||||||
|
image: aquasec/trivy
|
||||||
|
commands:
|
||||||
|
- trivy image --exit-code 1 --timeout 15m --severity CRITICAL khwezi/webapitest:${DRONE_BUILD_NUMBER}
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: deploy-to-uat
|
name: deploy
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-and-package
|
- package
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- promote
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: uat-deployment
|
- name: uat
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
host: { from_secret: ssh_host }
|
host:
|
||||||
username: { from_secret: ssh_user }
|
from_secret: ssh_host
|
||||||
password: { from_secret: ssh_password }
|
username:
|
||||||
|
from_secret: ssh_user
|
||||||
|
password:
|
||||||
|
from_secret: ssh_password
|
||||||
script:
|
script:
|
||||||
- echo $DOCKER_PASSWORD | docker login nexus.khongisa.co.za -u $DOCKER_USERNAME --password-stdin
|
- docker pull khwezi/webapitest:latest
|
||||||
- docker pull nexus.khongisa.co.za/webapitest:latest
|
- docker stop webapitest || true
|
||||||
- docker stop webapi 2>/dev/null || true
|
- docker rm webapitest || true
|
||||||
- docker rm webapi 2>/dev/null || true
|
- docker run -d --name webapitest -e ASPNETCORE_ENVIRONMENT=Development -p 4000:8081 khwezi/webapitest:latest
|
||||||
- docker run -d --name webapi --restart unless-stopped -e ASPNETCORE_ENVIRONMENT=Development -p 4000:8081 nexus.khongisa.co.za/webapitest:latest
|
|
||||||
environment:
|
|
||||||
DOCKER_USERNAME: { from_secret: docker_username }
|
|
||||||
DOCKER_PASSWORD: { from_secret: docker_password }
|
|
||||||
|
|
||||||
trigger:
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: golive
|
||||||
|
depends_on:
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: prod
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
environment:
|
||||||
|
SSH_USER:
|
||||||
|
from_secret: ssh_prod_user
|
||||||
|
SSH_PASS:
|
||||||
|
from_secret: ssh_prod_password
|
||||||
|
settings:
|
||||||
|
host: 192.168.1.48
|
||||||
|
username: ${SSH_USER}
|
||||||
|
password: ${SSH_PASS}
|
||||||
|
script:
|
||||||
|
- docker stop webapi || true
|
||||||
|
- docker rm webapi || true
|
||||||
|
- docker run -d --name webapi -e ASPNETCORE_ENVIRONMENT=Production -p 4001:8081 khwezi/webapitest:latest
|
||||||
|
when:
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
target:
|
target:
|
||||||
- staging
|
- prod
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM nexus.khongisa.co.za/aspnet:10.0 AS final
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
USER app
|
USER app
|
||||||
|
|||||||
@@ -9,11 +9,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="3.8.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
|
||||||
<PackageReference Include="Polly" Version="8.6.6" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.7" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user