Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions prdeploy-api/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
42 changes: 21 additions & 21 deletions prdeploy-api/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Amazon.AspNetCore.DataProtection.SSM" Version="3.5.0" />
<PackageVersion Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.400" />
<PackageVersion Include="AWSSDK.SecurityToken" Version="3.7.401.66" />
<PackageVersion Include="AWSSDK.SimpleSystemsManagement" Version="3.7.403.62" />
<PackageVersion Include="AWSSDK.SSO" Version="3.7.400.117" />
<PackageVersion Include="AWSSDK.SSOOIDC" Version="3.7.400.118" />
<PackageVersion Include="Amazon.AspNetCore.DataProtection.SSM" Version="4.0.1" />
<PackageVersion Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.3.14" />
<PackageVersion Include="AWSSDK.SecurityToken" Version="4.0.5.1" />
<PackageVersion Include="AWSSDK.SimpleSystemsManagement" Version="4.0.6.4" />
<PackageVersion Include="AWSSDK.SSO" Version="4.0.2.5" />
<PackageVersion Include="AWSSDK.SSOOIDC" Version="4.0.3.6" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="FluentValidation" Version="11.11.0" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="15.1.0" />
<PackageVersion Include="HotChocolate.AspNetCore.Authorization" Version="15.1.0" />
<PackageVersion Include="HotChocolate.Types" Version="15.1.0" />
<PackageVersion Include="LinqKit.Core" Version="1.2.8" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="9.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.3" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.3" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.2" />
<PackageVersion Include="FluentValidation" Version="12.1.0" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="15.1.11" />
<PackageVersion Include="HotChocolate.AspNetCore.Authorization" Version="15.1.11" />
<PackageVersion Include="HotChocolate.Types" Version="15.1.11" />
<PackageVersion Include="LinqKit.Core" Version="1.2.9" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="10.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Octokit" Version="14.0.0" />
<PackageVersion Include="RestSharp" Version="112.1.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageVersion Include="Serilog.Expressions" Version="5.0.0" />
<PackageVersion Include="StrawberryShake.Server" Version="15.1.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.6.1" />
<PackageVersion Include="StrawberryShake.Server" Version="15.1.11" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions prdeploy-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app
EXPOSE 8080

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG VERSION=1.0.0
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["Directory.Build.props", "."]
COPY ["Directory.Packages.props", "."]
COPY ["src/PrDeploy.Api/PrDeploy.Api.csproj", "src/PrDeploy.Api/"]
COPY ["src/PrDeploy.Api.Business/PrDeploy.Api.Business.csproj", "src/PrDeploy.Api.Business/"]
Expand Down
5 changes: 3 additions & 2 deletions prdeploy-api/prdeploy-api.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
# Visual Studio Version 18
VisualStudioVersion = 18.3.11222.16 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4AE5B802-264E-4EAE-8870-8BEE0E035BA5}"
EndProject
Expand All @@ -22,6 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{2D34
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public async Task<AccessTokenResponse> GetAccessTokenAsync(AccessTokenRequest ac
request.AddQueryParameter("client_secret", _gitHubOptions.ClientSecret);
request.AddQueryParameter("code", accessTokenRequest.Code);
request.AddQueryParameter("redirect_uri", accessTokenRequest.RedirectUrl);

// Add code_verifier if provided (required for PKCE flow)
if (!string.IsNullOrEmpty(accessTokenRequest.CodeVerifier))
{
request.AddQueryParameter("code_verifier", accessTokenRequest.CodeVerifier);
}

var response = await _client.PostAsync<AccessTokenResponse>(request);
var userInfo = await GetUserInfoAsync(response!.AccessToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" />
<PackageReference Include="AWSSDK.SecurityToken" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" />
<PackageReference Include="HotChocolate.Types" />
Expand Down
18 changes: 13 additions & 5 deletions prdeploy-api/src/PrDeploy.Api/Configuration/DotEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ public static void Load(string filePath)

foreach (var line in File.ReadAllLines(filePath))
{
var parts = line.Split(
'=',
StringSplitOptions.RemoveEmptyEntries);
var separator = line.IndexOf("=");

if (parts.Length != 2)
if (separator == -1)
{
continue;
}

Environment.SetEnvironmentVariable(parts[0], parts[1].Trim('"'));
var name = line.Substring(0, separator);
var value = line.Substring(separator + 1);

if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))
{
continue;
}

Environment.SetEnvironmentVariable(name, value.Trim('"'));
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions prdeploy-api/src/PrDeploy.Api/PrDeploy.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>ee2e9923-c992-48f1-b2ad-cdd432e4dafa</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
Expand All @@ -25,7 +22,6 @@
<PackageReference Include="HotChocolate.AspNetCore" />
<PackageReference Include="HotChocolate.AspNetCore.Authorization" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" />
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Expressions" />
Expand Down
2 changes: 1 addition & 1 deletion prdeploy-api/src/PrDeploy.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownIPNetworks.Clear();
options.KnownProxies.Clear();
})
.AddCors(options =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Runtime.Serialization;
using StrawberryShake;
using System.Text;
using StrawberryShake;

namespace PrDeploy.Api.Tests.Framework.Client
{
Expand All @@ -15,21 +14,15 @@ public ApiClientException(string message)

public ApiClientException(IClientError error)
{
if (error is null)
{
throw new ArgumentNullException(nameof(error));
}
ArgumentNullException.ThrowIfNull(error);

Message = error.Message;
Errors = new[] { error };
}

public ApiClientException(params IClientError[] errors)
{
if (errors is null)
{
throw new ArgumentNullException(nameof(errors));
}
ArgumentNullException.ThrowIfNull(errors);

if (errors.Length == 0)
{
Expand Down Expand Up @@ -71,15 +64,6 @@ public ApiClientException(IEnumerable<IClientError> errors)
{
}

protected ApiClientException(
SerializationInfo info,
StreamingContext context)
: base(info, context)
{
Message = base.Message;
Errors ??= Array.Empty<IClientError>();
}

/// <summary>
/// The aggregated error message.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<StrawberryShake_State>$(MSBuildProjectExtensionsPath)berry</StrawberryShake_State>
</PropertyGroup>
Expand Down