Skip to content

Commit 88558a3

Browse files
authored
Merge pull request #982 from DeveloperMetrics/UpgradeToDotNet8
Upgraded to .NET 8 and replaced deprecated NuGet packages
2 parents 9fbb102 + b076705 commit 88558a3

35 files changed

+134
-7551
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ updates:
3939
update-types: ["minor", "patch"]
4040
assignees:
4141
- "samsmithnz"
42-
# - package-ecosystem: npm
43-
# directory: /src/ProbotMetrics
44-
# schedule:
45-
# interval: daily
46-
# time: "06:00"
47-
# timezone: America/New_York
48-
# open-pull-requests-limit: 10
49-
# assignees:
50-
# - "samsmithnz"
5142
# Maintain dependencies for GitHub Actions
5243
- package-ecosystem: "github-actions"
5344
directory: "/"

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Setup .NET Core
5454
uses: actions/setup-dotnet@v3
5555
with:
56-
dotnet-version: 7.0.x
56+
dotnet-version: 8.0.x
5757

5858
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5959
# If this step fails, then you should remove it and run the build manually (see below)

.github/workflows/dotnetcore.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup .NET Core
3434
uses: actions/setup-dotnet@v3
3535
with:
36-
dotnet-version: 7.0.x
36+
dotnet-version: 8.0.x
3737

3838
#Publish dotnet objects
3939
- name: .NET Publish Web Service
@@ -44,12 +44,12 @@ jobs:
4444
- name: .NET Publish functional tests
4545
run: dotnet publish src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj --configuration Release --output ${{ github.workspace }}/functionalTests
4646
- name: Copy chromedriver for functional test
47-
run: copy "src/DevOpsMetrics.FunctionalTests/bin/Release/net7.0/chromedriver.exe" "${{ github.workspace }}/functionalTests"
47+
run: copy "src/DevOpsMetrics.FunctionalTests/bin/Release/net8.0/chromedriver.exe" "${{ github.workspace }}/functionalTests"
4848
shell: powershell
4949
- name: DotNet restore functional tests to get correct NewtonSoft version
5050
run: dotnet restore src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj
5151
- name: Copy new NewtonSoft version for functional test
52-
run: copy "src/DevOpsMetrics.FunctionalTests/bin/Release/net7.0/Newtonsoft.Json.dll" "${{ github.workspace }}/functionalTests"
52+
run: copy "src/DevOpsMetrics.FunctionalTests/bin/Release/net8.0/Newtonsoft.Json.dll" "${{ github.workspace }}/functionalTests"
5353
shell: powershell
5454

5555
#Publish build artifacts to GitHub
@@ -85,7 +85,7 @@ jobs:
8585
- name: Setup .NET Core
8686
uses: actions/setup-dotnet@v3
8787
with:
88-
dotnet-version: 7.0.x
88+
dotnet-version: 8.0.x
8989
#Run automated .NET tests
9090
- name: Variable Substitution appsettings file for tests
9191
uses: microsoft/variable-substitution@v1
@@ -116,7 +116,7 @@ jobs:
116116
- name: Setup .NET Core
117117
uses: actions/setup-dotnet@v3
118118
with:
119-
dotnet-version: 6.0.x #Not a typo, the function is locked to a LTS version of .NET
119+
dotnet-version: 8.0.x #Not a typo, the function is locked to a LTS version of .NET
120120
- name: .NET Publish Function
121121
run: dotnet publish src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj --configuration Debug --output ${{ github.workspace }}/function
122122
- name: Upload function build artifacts back to GitHub
@@ -135,7 +135,7 @@ jobs:
135135
uses: samsmithnz/[email protected]
136136
with:
137137
projects: 'src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj,src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj,src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj,src/DevOpsMetrics.Service/DevOpsMetrics.Service.csproj,src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj,src/DevOpsMetrics.Web/DevOpsMetrics.Web.csproj,src/DevOpsMetrics.Cmd/DevOpsMetrics.Cmd.csproj'
138-
dotnet-version: '7.0.x'
138+
dotnet-version: '8.0.x'
139139
sonarcloud-organization: samsmithnz-github
140140
sonarcloud-project: samsmithnz_DevOpsMetrics
141141
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
next-version: 1.9.0
1+
next-version: 1.10.0

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
[![Current Release](https://img.shields.io/github/release/samsmithnz/DevOpsMetrics/all.svg)](https://github.com/samsmithnz/DevOpsMetrics/releases)
77

88

9-
**Why should we care about DevOps Metrics and what are they?** All engineering, including software, needs metrics to track performance, but many metrics when measured individually, can be 'gamed', or don't encourage the right behaviors or incentives. This has been an issue with metrics for many years. The [DORA metrics](https://services.google.com/fh/files/misc/state-of-devops-2019.pdf) are a step in the right direction, combining several metrics that encourage the behaviors and incentives - and hence that encourage DevOps teams to perform at a high level of performance.
9+
**Why should we care about DevOps Metrics and what are they?** All engineering, including software, needs metrics to track performance, but many metrics when measured individually, can be 'gamed', or don't encourage the right behaviors or incentives. This has been an issue with metrics for many years. The [DORA metrics](https://services.google.com/fh/files/misc/state-of-devops-2019.pdf) are a step in the right direction, combining several metrics that encourage the behaviors and incentives - and hence that encourage DevOps teams to perform at a high level of performance. DORA metrics aren't perfect, but are still the best we have available today.
10+
- A [demo website displaying these metrics can be viewed here](https://devops-prod-eu-web.azurewebsites.net/).
11+
- Insights I've noted about implementing DORA DevOps metrics can be found in a [blog post here](https://samlearnsazure.blog/2020/04/30/high-performing-devops-metrics/)
1012

1113
This project is focused on helping you collect and analyze four key high performing DevOps metrics from GitHub and Azure DevOps. [DORA's "State of DevOps" research](https://cloud.google.com/blog/products/devops-sre/announcing-dora-2021-accelerate-state-of-devops-report) and [Accelerate](https://www.amazon.com/Accelerate-Software-Performing-Technology-Organizations/dp/1942788339) highlighted four driving indicators of high performing DevOps teams. While these four metrics are widely used in DevOps discussion, it's challenging to implement and capture all of the metrics.
1214

@@ -16,12 +18,10 @@ This project is focused on helping you collect and analyze four key high perform
1618
- **Change failure rate: After a production deployment, was it successful? Or was a fix or rollback required after the fact?** How often is a change we made 'successful'? This ties in well with deployment frequency and lead time for changes, but is challenging to measure - as it requires a signoff off of success. Not just that the code deployed correctly, but that there weren't adverse effects or degradation of the deployment to the system
1719

1820
![High performing metrics](https://user-images.githubusercontent.com/8389039/212061370-6984b2c3-bc13-4d92-8afc-0068be4cdde1.png)
19-
(Chart from [page 11 of state of DevOps 2022 report](https://cloud.google.com/devops/state-of-devops))
20-
A [demo website displaying the metrics can be viewed here](https://devops-prod-eu-web.azurewebsites.net/).
21-
More information about high performing DevOps metrics can be found in a [blog post here](https://samlearnsazure.blog/2020/04/30/high-performing-devops-metrics/)
21+
[^1]
2222

2323
## The current solution:
24-
**We currently have all four of the metrics implemented and undergoing a pilot. There is a Probot for GitHub. (The Azure DevOps widget is on hold to focus on GitHub).**
24+
**We currently have all four of the metrics implemented and undergoing a pilot. (The Azure DevOps widget is currently not planned - but is possible if someone wants to build it!).**
2525

2626
- **Deployment Frequency**, in both Azure DevOps and GitHub:
2727
- How does it work? We look at the number of successful pipeline runs.
@@ -63,12 +63,11 @@ More information about high performing DevOps metrics can be found in a [blog po
6363
![Change failure rate](https://github.com/samsmithnz/DevOpsMetrics/blob/main/ReadmeImages/ChangeFailureRate.png)
6464

6565
# Architecture
66-
Developed in .NET 7. A GitHub action runs the CI/CD process.
66+
Developed in .NET 8. A GitHub action runs the CI/CD process.
6767

6868
Currently the CI/CD process:
6969
1. Builds the code
7070
2. Runs the unit tests
71-
3. ~~Deploys the Probot code to a Azure web app (http://devops-prod-eu-probot.azurewebsites.net/)~~ (Currently disabled)
7271
3. Deploys the webservice to a Azure web app (https://devops-prod-eu-service.azurewebsites.net)
7372
4. Deploys the demo website to a Azure web app (https://devops-prod-eu-web.azurewebsites.net)
7473
4. Deploys the function website to a Azure function
@@ -78,7 +77,7 @@ Dependabot runs daily to check for dependency upgrades.
7877
![Architecture diagram](https://github.com/samsmithnz/DevOpsMetrics/blob/main/ReadmeImages/Architecture.png)
7978

8079
## Badges
81-
The API can generate a URL for static badges, but more work is needed. Some current samples are shown below:
80+
The API can generate a URL for static badges, some samples are shown below:
8281
[![Build](https://img.shields.io/badge/Lead%20time%20for%20changes-High-green)](https://img.shields.io/badge/Lead%20time%20for%20changes-High-green) [![Build](https://img.shields.io/badge/Time%20to%20restore%20service-Medium-orange)](https://img.shields.io/badge/Time%20to%20restore%20service-Medium-orange) [![Build](https://img.shields.io/badge/Change%20failure%20rate-Low-red)](https://img.shields.io/badge/Change%20failure%20rate-Low-red)
8382

8483
# Setup
@@ -94,11 +93,12 @@ The API can generate a URL for static badges, but more work is needed. Some curr
9493
# What's next?
9594
- Upgrades to packaging and setup (in progress)
9695
- Upgrades to store data in CosmosDB (currently in Azure storage)
97-
- Reviewing the current GitHub probot approach, to find a better target than issues (perhaps a metrics readme.md file?)
9896
- Support for more scenarios, releases, etc
9997
- ~~Azure DevOps marketplace integrations, so you can see the changes real time on your project/repo.~~ (lower priority to focus on GitHub)
10098

10199
# References
102100

103101
- GitHub API: https://developer.GitHub.com/v3/actions/workflow-runs/
104102
- Azure DevOps API: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-5.1
103+
104+
[^1]: Chart from [page 11 of state of DevOps 2022 report](https://cloud.google.com/devops/state-of-devops)

src/DevOpsMetrics.Cmd/DevOpsMetrics.Cmd.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<UserSecretsId>dc96f8ff-2de5-4ed3-b124-89a134688b66</UserSecretsId>
@@ -19,7 +19,10 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
22+
<PackageReference Include="Azure.Identity" Version="1.10.4" />
23+
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.5.0" />
24+
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
25+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
2326
</ItemGroup>
2427

2528
<ItemGroup>

src/DevOpsMetrics.Cmd/Program.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
using DevOpsMetrics.Core.DataAccess.TableStorage;
1+
using Azure.Identity;
2+
using DevOpsMetrics.Core.DataAccess.TableStorage;
23
using DevOpsMetrics.Core.Models.AzureDevOps;
34
using DevOpsMetrics.Core.Models.Common;
45
using DevOpsMetrics.Core.Models.GitHub;
56
using DevOpsMetrics.Service;
67
using DevOpsMetrics.Service.Controllers;
7-
using Microsoft.Azure.KeyVault;
8-
using Microsoft.Azure.Services.AppAuthentication;
98
using Microsoft.Extensions.Configuration;
109
using Microsoft.Extensions.Logging;
10+
using Azure.Core;
11+
using Azure.Identity;
1112

1213
namespace DevOpsMetrics.Cmd
1314
{
@@ -28,12 +29,22 @@ static async Task Main()
2829
IConfigurationRoot Configuration = builder.Build();
2930
ILogger log = new Logger<Program>(new LoggerFactory());
3031

31-
string keyVaultURL = Configuration["AppSettings:KeyVaultURL"];
32-
string keyVaultId = Configuration["AppSettings:KeyVaultClientId"];
33-
string keyVaultSecret = Configuration["AppSettings:KeyVaultClientSecret"];
34-
AzureServiceTokenProvider azureServiceTokenProvider = new();
35-
KeyVaultClient keyVaultClient = new(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
36-
builder.AddAzureKeyVault(keyVaultURL, keyVaultId, keyVaultSecret);
32+
string? keyVaultURL = Configuration["AppSettings:KeyVaultURL"];
33+
string? keyVaultId = Configuration["AppSettings:KeyVaultClientId"];
34+
string? keyVaultSecret = Configuration["AppSettings:KeyVaultClientSecret"];
35+
string? tenantId = Configuration["AppSettings:TenantId"];
36+
//AzureServiceTokenProvider azureServiceTokenProvider = new();
37+
//KeyVaultClient keyVaultClient = new(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
38+
//builder.AddAzureKeyVault(keyVaultURL, keyVaultId, keyVaultSecret);
39+
if (keyVaultURL != null && keyVaultId != null && keyVaultSecret != null && tenantId != null)
40+
{
41+
TokenCredential tokenCredential = new ClientSecretCredential(tenantId, keyVaultId, keyVaultSecret);
42+
builder.AddAzureKeyVault(new(keyVaultURL), tokenCredential);
43+
}
44+
else
45+
{
46+
throw new System.Exception("Missing configuration for Azure Key Vault");
47+
}
3748
Configuration = builder.Build();
3849
ServiceApiClient serviceApiClient = new(Configuration);
3950

src/DevOpsMetrics.Cmd/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"WebServiceURL": "https://devops-prod-eu-service.azurewebsites.net/",
2020
"KeyVaultURL": "https://devops-prod-eu-vault.vault.azure.net/",
2121
"KeyVaultClientId": "",
22-
"KeyVaultClientSecret": ""
22+
"KeyVaultClientSecret": "",
23+
"TenantId": "40244aae-8aee-4af5-b221-b480db24698b"
2324
},
2425
"ApplicationInsights": {
2526
"InstrumentationKey": "dc3fb590-3612-4f09-8c95-e9378cba8654"

src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
9-
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
8+
<PackageReference Include="Azure.Data.Tables" Version="12.8.2" />
109
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
1110
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1211
<PackageReference Include="System.Linq.Async" Version="6.0.1" />

src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<!-- This needs to stay as a LTS .NET version, otherwise the function needs to be rewritten as an isolated process -->
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
66
<UserSecretsId>ed162474-1392-455c-b088-8b07e5438062</UserSecretsId>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
10-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
9+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
1110
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
11+
<PackageReference Include="Azure.Identity" Version="1.10.4" />
12+
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
1213
</ItemGroup>
1314
<ItemGroup>
1415
<ProjectReference Include="..\DevOpsMetrics.Core\DevOpsMetrics.Core.csproj" />

0 commit comments

Comments
 (0)