Compare commits
85
Commits
test
..
1d4009cc68
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d4009cc68 | ||
|
|
21e4c3940a | ||
|
|
0c901d32d8 | ||
|
|
38cbf5b656 | ||
|
|
1263ad8571 | ||
|
|
8d12af4e10 | ||
|
|
099bc0c515 | ||
|
|
1cb1481ab8 | ||
|
|
f6bcbb6674 | ||
|
|
6f395f9db7 | ||
|
|
080d09fca3 | ||
|
|
18bc75b687 | ||
|
|
dd5ad891ab | ||
|
|
247aa96d19 | ||
|
|
de0820dcc2 | ||
|
|
7071441d12 | ||
|
|
48b884ae72 | ||
|
|
1e66974684 | ||
|
|
b3fa0e5138 | ||
|
|
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 |
+60
-45
@@ -1,68 +1,83 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-package
|
||||
name: cicd-pipeline
|
||||
|
||||
# Let Drone handle the clone automatically; it's faster and cleaner.
|
||||
clone:
|
||||
depth: 1
|
||||
|
||||
steps:
|
||||
- name: build-test-publish
|
||||
image: nexus.khongisa.co.za/sdk:10.0
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
commands:
|
||||
- dotnet restore --source https://nexus.khongisa.co.za/repository/nuget-group/index.json --no-cache
|
||||
- dotnet restore
|
||||
- dotnet build --configuration Release --no-restore
|
||||
- dotnet test --configuration Release --no-build
|
||||
- dotnet publish --configuration Release --no-build
|
||||
|
||||
- name: docker-build-and-push
|
||||
# --- PACKAGE STAGE ---
|
||||
# We build the image locally first so we can scan it BEFORE pushing
|
||||
- name: docker-build
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: nexus.khongisa.co.za
|
||||
repo: nexus.khongisa.co.za/webapitest
|
||||
repo: nexus.khongisa.co.za/mngomalab/webapitest
|
||||
tags: [ "${DRONE_BUILD_NUMBER}", "latest" ]
|
||||
username: { from_secret: docker_username }
|
||||
password: { from_secret: docker_password }
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
# This builds the image and loads it into the local cache for scanning
|
||||
dry_run: true
|
||||
# Set to false once you verify the scan passes, or see the step below
|
||||
|
||||
- name: vulnerability-scan
|
||||
image: aquasec/trivy:0.50.1
|
||||
image: aquasec/trivy
|
||||
environment:
|
||||
TRIVY_USERNAME: { from_secret: docker_username }
|
||||
TRIVY_PASSWORD: { from_secret: docker_password }
|
||||
# Trivy needs these to pull the image from your Nexus to scan it
|
||||
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}
|
||||
- trivy image --exit-code 1 --severity CRITICAL nexus.khongisa.co.za/mngomalab/webapitest:${DRONE_BUILD_NUMBER}
|
||||
|
||||
- name: docker-push
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: nexus.khongisa.co.za
|
||||
repo: nexus.khongisa.co.za/mngomalab/webapitest
|
||||
tags: [ "${DRONE_BUILD_NUMBER}", "latest" ]
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
# --- DEPLOY STAGE ---
|
||||
- name: deploy-uat
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_host
|
||||
username:
|
||||
from_secret: ssh_user
|
||||
password:
|
||||
from_secret: ssh_password
|
||||
script:
|
||||
# Login to Nexus on the remote server
|
||||
- echo $DOCKER_PASSWORD | docker login nexus.khongisa.co.za -u $DOCKER_USERNAME --password-stdin
|
||||
- docker pull nexus.khongisa.co.za/mngomalab/webapitest:latest
|
||||
# Standard Linux cleanup
|
||||
- docker stop webapi 2>/dev/null || true
|
||||
- docker rm webapi 2>/dev/null || true
|
||||
- docker run -d --name webapi --restart unless-stopped -e ASPNETCORE_ENVIRONMENT=Development -p 4000:8081 nexus.khongisa.co.za/mngomalab/webapitest:latest
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: docker_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: docker_password
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
exclude:
|
||||
- promote
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy-to-uat
|
||||
|
||||
depends_on:
|
||||
- build-and-package
|
||||
|
||||
steps:
|
||||
- name: uat-deployment
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host: { from_secret: ssh_host }
|
||||
username: { from_secret: ssh_user }
|
||||
password: { from_secret: ssh_password }
|
||||
script:
|
||||
- echo $DOCKER_PASSWORD | docker login nexus.khongisa.co.za -u $DOCKER_USERNAME --password-stdin
|
||||
- docker pull nexus.khongisa.co.za/webapitest:latest
|
||||
- docker stop webapi 2>/dev/null || true
|
||||
- docker rm webapi 2>/dev/null || true
|
||||
- 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:
|
||||
event:
|
||||
- promote
|
||||
target:
|
||||
- staging
|
||||
+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
|
||||
|
||||
USER app
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.8.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>
|
||||
|
||||
Reference in New Issue
Block a user