Skip to content

Commit

Permalink
Target all projects to .NET 8
Browse files Browse the repository at this point in the history
Signed-off-by: Jatin Sanghvi <[email protected]>
  • Loading branch information
JatinSanghvi committed Nov 22, 2024
1 parent 4feaa7f commit 3ad7b02
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup dotnet environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6
dotnet-version: 8

- name: Install dependencies
run: dotnet restore src
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup dotnet environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6
dotnet-version: 8

- name: Install dependencies
run: dotnet restore src
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup dotnet environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6
dotnet-version: 8

- name: Install dependencies
run: dotnet restore src
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Scaler/bin/Debug/net6.0/Keda.CosmosDb.Scaler.dll",
"program": "${workspaceFolder}/src/Scaler/bin/Debug/net8.0/Keda.CosmosDb.Scaler.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Scaler",
"stopAtEntry": false,
Expand Down
4 changes: 2 additions & 2 deletions src/Scaler.Demo/OrderGenerator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://hub.docker.com/_/microsoft-dotnet

# Restore, build and publish project.
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /
COPY src/Scaler.Demo/OrderGenerator/ src/Scaler.Demo/OrderGenerator/
COPY src/Scaler.Demo/Shared/ src/Scaler.Demo/Shared/
Expand All @@ -10,7 +10,7 @@ WORKDIR /src/Scaler.Demo/OrderGenerator
RUN dotnet publish --configuration Release --output /app

# Stage application.
FROM mcr.microsoft.com/dotnet/runtime:6.0
FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Keda.CosmosDb.Scaler.Demo.OrderGenerator.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.40.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Bogus" Version="35.6.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.46.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Scaler.Demo/OrderProcessor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://hub.docker.com/_/microsoft-dotnet

# Restore, build and publish project.
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /
COPY src/Scaler.Demo/OrderProcessor/ src/Scaler.Demo/OrderProcessor/
COPY src/Scaler.Demo/Shared/ src/Scaler.Demo/Shared/
Expand All @@ -10,7 +10,7 @@ WORKDIR /src/Scaler.Demo/OrderProcessor
RUN dotnet publish --configuration Release --output /app

# Stage application.
FROM mcr.microsoft.com/dotnet/runtime:6.0
FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Keda.CosmosDb.Scaler.Demo.OrderProcessor.dll"]
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.40.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.46.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
24 changes: 24 additions & 0 deletions src/Scaler.Demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,27 @@ We will later deploy the order-processor application to Kubernetes cluster and u
2021-09-03 12:57:53 info: Keda.CosmosDb.Scaler.Demo.OrderProcessor.Worker[0]
Processing order ca17597f-7aa2-4b04-abd8-724139b2c370 - 1 unit(s) of Gloves bought by Donny Shanahan
```
## Cleaning sample application from cluster
1. Delete the scaled object and order-processor application.
```text
# kubectl delete scaledobject cosmosdb-order-processor-scaledobject
# kubectl delete deployment cosmosdb-order-processor
```
1. Optionally, delete the external scaler and KEDA from cluster. The following commands assume that KEDA was installed with Helm.
```text
# kubectl delete service cosmosdb-scaler
# kubectl delete deployment cosmosdb-scaler
# helm uninstall keda --namespace keda
# kubectl delete namespace keda
```
1. The monitored container can be deleted with the below command. The lease container can be deleted on Azure Portal.
```text
# docker run --env CosmosDbConfig__Connection="<connection-string>" --interactive --rm --tty cosmosdb-order-generator teardown
```
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.40.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.46.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="NewtonSoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions src/Scaler.Tests/Keda.CosmosDb.Scaler.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/Scaler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# https://hub.docker.com/_/microsoft-dotnet

# Restore, build and publish project.
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /
COPY src/Scaler/ src/Scaler/

WORKDIR /src/Scaler
RUN dotnet publish --configuration Release --output /app

# Stage application.
FROM mcr.microsoft.com/dotnet/aspnet:6.0
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Keda.CosmosDb.Scaler.dll"]
8 changes: 4 additions & 4 deletions src/Scaler/Keda.CosmosDb.Scaler.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Protobuf Include="Protos\externalscaler.proto" GrpcServices="Server" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.63.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.40.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.67.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.46.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="NewtonSoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down

0 comments on commit 3ad7b02

Please sign in to comment.