Compare commits

..

48 Commits

Author SHA1 Message Date
1a8e9abb3e Merge pull request 'MOved donet package step to build stage' (#49) from test into main
Reviewed-on: #49
2026-03-08 13:10:16 +02:00
09558ce984 Merge pull request 'Refactored docker file' (#48) from test into main
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #48
2026-03-08 13:05:52 +02:00
a20c90039b Merge pull request 'Currected docker port' (#47) from test into main
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #47
2026-03-08 12:58:52 +02:00
da229bf4ec Merge pull request 'Allowing for UAT deployment to happen automatically' (#46) from test into main
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #46
2026-03-08 12:52:28 +02:00
6bc8e5e703 Merge pull request 'Refactored pipeline to manage triggers better for promotion events' (#45) from test into main
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #45
2026-03-08 12:48:40 +02:00
8fce29f5ab Merge pull request 'Added staging behavior to the pipeline' (#44) from test into main
Some checks failed
continuous-integration/drone Build is passing
continuous-integration/drone/promote/uat Build is failing
Reviewed-on: #44
2026-03-08 12:39:19 +02:00
79a3d87668 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
2026-03-08 12:34:57 +02:00
833bfafa7f Merge pull request 'Brought back auto clone disable' (#42) from test into main
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #42
2026-03-08 12:16:21 +02:00
2477602874 Merge pull request 'Refactored step names' (#41) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #41
2026-03-08 12:15:07 +02:00
8afd460a3c Merge pull request 'test' (#40) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: #40
2026-03-08 12:12:24 +02:00
10d9186f92 Merge pull request 'Refactored kaniko to use another config file path' (#39) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #39
2026-03-08 12:04:29 +02:00
41538c6376 Merge pull request 'Using CI/CD version of kaniko docker image' (#38) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #38
2026-03-08 12:01:19 +02:00
94ad00974d Merge pull request 'test' (#37) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: #37
2026-03-08 11:58:01 +02:00
45171382f0 Merge pull request 'ENabled priviledged mode on docker push step' (#36) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: #36
2026-03-08 11:43:19 +02:00
eb4884eab5 Merge pull request 'Using manual docker push' (#35) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #35
2026-03-08 11:39:46 +02:00
2b3bd2897c Merge pull request 'test' (#34) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #34
2026-03-08 11:34:50 +02:00
1831c79554 Merge pull request 'Removed debug flag from docker push, removed drone build number tag' (#33) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #33
2026-03-08 11:22:24 +02:00
909b9e742a Merge pull request 'Using raw username' (#32) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #32
2026-03-08 11:15:49 +02:00
bec8ce3e74 Merge pull request 'Added debug flag' (#31) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #31
2026-03-08 11:05:36 +02:00
6ee84199b2 Merge pull request 'Added tagging' (#30) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #30
2026-03-08 10:57:34 +02:00
895bce48d2 Merge pull request 'Disabled broken automatic clone, added manual clone' (#29) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #29
2026-03-08 10:49:44 +02:00
087358efc6 Merge pull request 'Light refactor' (#28) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/28
2026-03-08 08:52:45 +02:00
d828595384 Merge pull request 'test' (#27) from test into main
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/27
2026-03-08 08:41:23 +02:00
8cff952b17 Merge pull request 'Reverted to registry proxy' (#26) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/26
2026-03-07 17:59:15 +02:00
1af6ceb288 Merge pull request 'talking to registry directly' (#25) from test into main
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/25
2026-03-07 17:58:42 +02:00
d801f96fb9 Merge pull request 'Not ignoring bin folder' (#24) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/24
2026-03-07 17:13:36 +02:00
1cc3750fa3 Merge pull request 'Allowing .net 8 publish files' (#23) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/23
2026-03-07 17:09:14 +02:00
e38dff6e92 Merge pull request 'Added dockerignore rule to allow all publish folders' (#22) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/22
2026-03-07 17:06:06 +02:00
c4b125a580 Merge pull request 'Rfactored dockerfile to reuse pipeline publish output' (#21) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/21
2026-03-07 17:01:37 +02:00
c9de909eb6 Merge pull request 'Refactored the source context in the package step' (#20) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/20
2026-03-07 16:55:39 +02:00
7eb870a29c Merge pull request 'Removed credentials from package operation' (#19) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/19
2026-03-07 16:50:21 +02:00
83c7844880 Merge pull request 'test' (#18) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/18
2026-03-07 16:44:12 +02:00
69b92e9323 Merge pull request 'Changed to gitea-token' (#17) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/17
2026-03-07 11:35:25 +02:00
fcfd265c46 Merge pull request 'Flattened pipeline stages' (#16) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/16
2026-03-07 11:23:56 +02:00
bc3a44d5ea Merge pull request 'Changed pipeline type from kubernetes to docker' (#15) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/15
2026-03-07 11:19:11 +02:00
cded235985 Merge pull request 'test' (#14) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/14
2026-03-07 11:14:59 +02:00
f15143349e Merge pull request 'Refactored docker-compose.yml to expose ports and specify environment' (#13) from test into main
Some checks failed
continuous-integration/drone Build was killed
Reviewed-on: #13
2026-03-03 17:46:35 +02:00
7d8f15104c Merge pull request 'Refactored dockerfile stage 2 ports exposure' (#12) from test into main
Reviewed-on: #12
2026-03-03 17:43:34 +02:00
e2b5f2db8c Merge pull request 'Exposed ports on dockerfile' (#11) from test into main
Reviewed-on: #11
2026-03-03 17:41:06 +02:00
57ba629d2d Merge pull request 'Refactored dockerfile' (#10) from test into main
Reviewed-on: #10
2026-03-03 17:34:50 +02:00
d30ee959ee Merge pull request 'Refactored docker file' (#9) from test into main
Reviewed-on: #9
2026-03-03 17:27:19 +02:00
4e653fd91d Merge pull request 'Refactored docker file' (#8) from test into main
Reviewed-on: #8
2026-03-03 15:06:12 +02:00
b4ee875ac8 Merge pull request 'Added debug lines' (#7) from test into main
Reviewed-on: #7
2026-03-03 14:57:27 +02:00
7d395e2295 Merge pull request 'Refactored paths' (#6) from test into main
Reviewed-on: #6
2026-03-03 14:56:07 +02:00
ddc66efc16 Merge pull request 'test' (#5) from test into main
Reviewed-on: #5
2026-03-03 14:54:08 +02:00
82348a0112 Merge pull request 'Refactored dockerfile' (#4) from test into main
Reviewed-on: #4
2026-03-03 14:50:40 +02:00
e495be1c0b Merge pull request 'Fixed docker image typo' (#3) from test into main
Reviewed-on: #3
2026-03-03 14:44:38 +02:00
5a530210c0 Merge pull request 'Refactored docker file image to SDK' (#2) from test into main
Reviewed-on: #2
2026-03-03 13:38:04 +02:00
6 changed files with 127 additions and 112 deletions

View File

@@ -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/

View File

@@ -1,68 +1,127 @@
--- ---
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:8.0
commands:
- dotnet build --configuration Release
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet test --configuration Release
- name: dotnet publish
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet publish --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: 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}
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: deploy-to-uat name: deploy
depends_on: depends_on:
- build-and-package - 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: trigger:
event: event:
- promote exclude:
target: - promote
- staging
clone:
disable: true
steps:
- name: uat
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user
password:
from_secret: ssh_password
script:
- docker pull khwezi/webapitest:latest
- docker stop webapitest || true
- docker rm webapitest || true
- docker run -d --name webapitest -p 4000:8081 khwezi/webapitest:latest
- name: prod
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user
password:
from_secret: ssh_password
script:
- docker pull khwezi/webapitest:latest
- docker stop webapi || true
- docker rm webapi || true
- docker run -d --name webapi -p 4001:8081 khwezi/webapitest:latest
when:
event:
- promote
target:
- prod

View File

@@ -1,11 +1,10 @@
FROM nexus.khongisa.co.za/aspnet:10.0 AS final FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app WORKDIR /app
USER app COPY ./SampleApi/bin/Release/net8.0/publish/ .
COPY --chown=app:app ./SampleApi/bin/Release/net10.0/publish/ .
EXPOSE 8081
ENV ASPNETCORE_HTTP_PORTS=8081 ENV ASPNETCORE_HTTP_PORTS=8081
EXPOSE 8081
WORKDIR /app
ENTRYPOINT ["dotnet", "SampleApi.dll"] ENTRYPOINT ["dotnet", "SampleApi.dll"]

View File

@@ -1,43 +0,0 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace SampleApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DemoController : ControllerBase
{
// GET: api/<DemoController>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<DemoController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<DemoController>
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/<DemoController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<DemoController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

View File

@@ -1,22 +1,25 @@
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
builder.Services.AddHealthChecks();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI();
} }
app.MapHealthChecks("/health");
app.UseRouting();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseAuthorization(); app.UseAuthorization();
app.MapControllers(); app.MapControllers();
app.Run(); app.Run();

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId> <UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId>
@@ -9,9 +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="Polly" Version="8.6.6" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.7" />
</ItemGroup> </ItemGroup>
</Project> </Project>