Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c557e12
Try deploy as bicep
KarsonAlford Oct 3, 2025
6d90363
Update chrome extension
KarsonAlford Oct 3, 2025
4d00254
Fix path
KarsonAlford Oct 3, 2025
46d0d3a
Make sure it checks out
KarsonAlford Oct 3, 2025
ba10714
Wrong job
KarsonAlford Oct 3, 2025
958dfec
Add DNS and switch to WindowsAgent pool
KarsonAlford Oct 3, 2025
529af7b
Dont create RG and just delete the container app
KarsonAlford Oct 3, 2025
737fd9e
Assume tooling is available
KarsonAlford Oct 3, 2025
5c89909
Use relative path
KarsonAlford Oct 3, 2025
86cdf17
Something weird with paths
KarsonAlford Oct 3, 2025
a3d7461
Fun with paths
KarsonAlford Oct 3, 2025
49ff8c7
Specify path
KarsonAlford Oct 3, 2025
4e25cf5
Folders fixe and fix casing
KarsonAlford Oct 3, 2025
7932048
Use branch for testing
KarsonAlford Oct 4, 2025
4b2d68b
Add InternalOnly param
KarsonAlford Oct 4, 2025
cdf36ad
upgrade to .net 8
KarsonAlford Oct 20, 2025
eb55c6f
Latest chrome extension
KarsonAlford Oct 20, 2025
d864895
Remove kubernetes references copied from original
KarsonAlford Oct 20, 2025
f347996
Remove VS kubernetes tools
KarsonAlford Oct 20, 2025
526f490
Add remove cae integration
KarsonAlford Oct 20, 2025
16b4e8f
Just the name please
KarsonAlford Oct 20, 2025
ef63ce0
Couldn't have no checkout
KarsonAlford Oct 20, 2025
d4e8976
Fix depends on
KarsonAlford Oct 20, 2025
54b731e
Deploy not build
KarsonAlford Oct 20, 2025
bdd0b86
Order matters
KarsonAlford Oct 20, 2025
87cb766
Fix targetport
KarsonAlford Oct 20, 2025
679df05
Add environment name
KarsonAlford Oct 20, 2025
ab53fa1
Adds hello-world Terraform IaC using modules
Oct 24, 2025
522f86c
gitignore updated
hugoglez-nc Oct 27, 2025
843626e
main vars updated
hugoglez-nc Oct 27, 2025
7c75c7d
updates to naming module
hugoglez-nc Oct 27, 2025
157de00
updates to tf code and new tf pipeline (wip)
hugoglez-nc Oct 28, 2025
15d976c
updates to terraform modules
hugoglez-nc Oct 28, 2025
1ac342f
bicep code migrated to terraform
hugoglez-nc Oct 31, 2025
1f39b47
tf container app use managed identity & new tf pipeline (wip)
hugoglez-nc Nov 4, 2025
796d578
gitignore updated
hugoglez-nc Nov 4, 2025
3facf03
readme updated
hugoglez-nc Nov 4, 2025
ee482d1
readme updated
hugoglez-nc Nov 4, 2025
6a35162
state file created dinamically per build
hugoglez-nc Nov 5, 2025
b5a0788
fixes to terraform vars
hugoglez-nc Nov 5, 2025
e5c627b
updates to migrate bicep to terraform on helloworld pipeline (wip)
hugoglez-nc Nov 7, 2025
ebfdd20
using windows self-hosted agents
hugoglez-nc Nov 7, 2025
79fccd6
switching tf tasks from bash to powershell to use them with windows a…
hugoglez-nc Nov 7, 2025
a3c535e
fixes to stage conditions
hugoglez-nc Nov 7, 2025
44b5824
debugging issue running pipeline
hugoglez-nc Nov 7, 2025
27b22f7
debugging issue with terraform
hugoglez-nc Nov 7, 2025
1cc5f21
selenium tests migrated to playwright
hugoglez-nc Nov 12, 2025
6e4aae6
task added to pipeline to troubleshoot connectivity issue between age…
hugoglez-nc Nov 13, 2025
c9da603
run tests and comment out teardown on pipeline
Nov 16, 2025
3e3171c
fixes to test stage added
hugoglez-nc Nov 17, 2025
a431e58
fixes to test stage added
hugoglez-nc Nov 17, 2025
dd6931a
test stage variable fixed
hugoglez-nc Nov 17, 2025
c10e74c
test stage variable added to tasks
hugoglez-nc Nov 17, 2025
5c0bea3
fixes and validation to test stage added
hugoglez-nc Nov 18, 2025
4477b4b
infra templates poiting to main branch
hugoglez-nc Nov 18, 2025
7fd3752
continueOnError added to remove CAE-appgw integration
hugoglez-nc Nov 18, 2025
40cb0f3
continueOnError added to remove CAE-appgw integration
hugoglez-nc Nov 18, 2025
2a49768
teardown stage dependson test stage
hugoglez-nc Nov 18, 2025
d3c9780
checkout added to teardownca job
hugoglez-nc Nov 18, 2025
a36890c
small fixes added before creating PR
hugoglez-nc Nov 19, 2025
31c83dd
fix to container_name in terraform backend
hugoglez-nc Nov 19, 2025
0178805
local scripts removed
hugoglez-nc Nov 19, 2025
62a6ef1
tf code and comments clean-up
hugoglez-nc Nov 21, 2025
d5b544e
build & push task expects a service connection instead of managed ide…
hugoglez-nc Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ node_modules/
*.dsw
*.dsp

# Visual Studio 6 technical files
# Visual Studio 6 technical files
*.ncb
*.aps

Expand Down Expand Up @@ -396,3 +396,19 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

# AI Agents for Visual Studio
copilot-instructions.md

# Terraform local files
*.tstate
*.tstate.backup
.terraform/
.terraform.lock.hcl
*/.terraform.lock.hcl
tf_run_local.sh

# Local tests files
test_local_*.sh
HomeTestLocal.*
temp/
140 changes: 140 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is an ASP.NET Core 8.0 MVC web application deployed to Azure Container Apps via Azure DevOps pipelines.

## Technology Stack

- **Application**: ASP.NET Core 8.0 MVC (C#)
- **Container Runtime**: Docker
- **Cloud Platform**: Azure Container Apps
- **Testing**: NUnit with Selenium WebDriver (Chrome)
- **CI/CD**: Azure DevOps Pipelines

## Common Commands

### Local Development

**Build Docker image locally:**
```powershell
cd HelloWorld
docker build -t example/helloworld -f Dockerfile . --no-cache
```

### Testing

**Run integration tests:**
```bash
dotnet build --configuration Debug
dotnet test HelloWorld.IntegrationTests/HelloWorld.IntegrationTests.csproj
```

**Run single test:**
```bash
dotnet test HelloWorld.IntegrationTests/HelloWorld.IntegrationTests.csproj --filter "FullyQualifiedName~NavigateToWebsiteRoot"
```

**Note**: Integration tests require ChromeDriver. Set the `HomePageUrl` environment variable to point to your Container App URL.

### Azure Container Apps Operations

**View Container Apps:**
```bash
az containerapp list --resource-group <resource-group-name> -o table
```

**View Container App logs:**
```bash
az containerapp logs show --name <container-app-name> --resource-group <resource-group-name> --follow
```

**Get Container App URL:**
```bash
az containerapp show --name <container-app-name> --resource-group <resource-group-name> --query properties.configuration.ingress.fqdn -o tsv
```

## Architecture

### Solution Structure

```
HelloWorld/ # Main ASP.NET Core MVC application
├── Controllers/ # MVC Controllers (HomeController)
├── Models/ # View Models (ErrorViewModel)
├── Views/ # Razor views
├── wwwroot/ # Static files (CSS, JS, libraries)
├── Dockerfile # Multi-stage build for container
└── HelloWorld.csproj # Project file

HelloWorld.IntegrationTests/ # Selenium UI tests
└── HomeTest.cs # Page object pattern tests

Infrastructure/
└── Pipelines/ # Azure DevOps pipeline definitions
├── helloworld-dev-pipeline.yml # Build, deploy to Container Apps, test, teardown
├── container-app.bicep # Bicep template for Container App
└── reset-test.yml # Pipeline reset pattern
```

### Application Flow

1. **Entry Point**: [Program.cs](HelloWorld/Program.cs) creates host using [Startup.cs](HelloWorld/Startup.cs)
2. **Startup**: Configures MVC with default routing pattern `{controller=Home}/{action=Index}/{id?}`
3. **Controller**: [HomeController.cs](HelloWorld/Controllers/HomeController.cs) handles Index, Privacy, and Error actions
4. **Views**: Razor views in Views/Home/ rendered by controller actions

### Deployment Flow

1. **Docker Build**: Multi-stage Dockerfile builds application in SDK container, publishes to runtime container
2. **Container Registry**: Image pushed to Azure Container Registry
3. **Container App**: Deployed using Bicep template with ingress configuration
4. **Testing**: Integration tests run against deployed Container App
5. **Teardown**: Optional cleanup of Container App resources

## Azure DevOps Pipeline

[Infrastructure/Pipelines/helloworld-dev-pipeline.yml](Infrastructure/Pipelines/helloworld-dev-pipeline.yml) defines the Azure Container Apps deployment pipeline:

1. **Build Stage**: Builds and pushes Docker image to Azure Container Registry
2. **Deploy Stage**: Creates Azure Container App with ingress using Bicep template
3. **Test Stage**: Runs integration tests against deployed Container App URL
4. **Teardown Stage**: Optionally deletes Container App (controlled by `teardown` parameter)

**Required Pipeline Variables:**
- `ContainerRegistrySC`: Service connection for ACR
- `AzureResourceManagerSC`: Azure subscription service connection
- `ContainerAppEnvironment`: Container App Environment ID
- `ContainerRegistryLoginServer`, `ContainerRegistryUsername`, `ContainerRegistryPassword`
- `LogAnalyticsWorkspace`, `LogAnalyticsResourceGroup`

## Integration Testing

Tests in [HelloWorld.IntegrationTests/HomeTest.cs](HelloWorld.IntegrationTests/HomeTest.cs) use:

- **Framework**: NUnit
- **Browser Automation**: Selenium WebDriver with ChromeDriver
- **Pattern**: Page Object pattern (HelloWorldHome class)
- **Configuration**: `HomePageUrl` environment variable is automatically set in Azure DevOps pipeline to the deployed Container App URL

Test scenarios:
- Navigate to root and verify home page
- Navigate to Privacy page via nav link
- Navigate back to Home via brand link

## Key Dependencies

- Azure subscription with Container Apps resources
- Azure Container Registry
- .NET 8.0 SDK
- Docker
- Chrome browser (for integration tests)

## Important Notes

- Container Apps automatically handle SSL/TLS certificates and ingress
- Integration tests retrieve the Container App URL dynamically from the deployment
- Teardown stage can be controlled via pipeline parameter to preserve or delete resources
- Application uses MVC with runtime Razor compilation enabled for development
40 changes: 0 additions & 40 deletions Documentation/SampleCommands.ps1

This file was deleted.

11 changes: 5 additions & 6 deletions HelloWorld.IntegrationTests/HelloWorld.IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="OpenQA.Selenium.Chrome.ChromeDriverExtensions" Version="1.2.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="127.0.6533.11900" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.48.0" />
</ItemGroup>

</Project>
Loading
Loading