Skip to content

Commit

Permalink
Jennyf/client sem ver (#2990)
Browse files Browse the repository at this point in the history
* remove clientSemver for MicrosoftIdentityWebVersion

* replace a few more with MicrosoftIdentityWebVersion
  • Loading branch information
jennyf19 authored Aug 19, 2024
1 parent 287c8e6 commit 23f6d94
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<!--This should be passed from the VSTS build-->
<ClientSemVer Condition="'$(ClientSemVer)' == ''">2.12.4</ClientSemVer>
<MicrosoftIdentityWebVersion Condition="'$(MicrosoftIdentityWebVersion)' == ''">2.12.4</MicrosoftIdentityWebVersion>
<!--This will generate AssemblyVersion, AssemblyFileVersion and AssemblyInformationVersion-->
<PackageVersion>$(ClientSemVer)</PackageVersion>
<PackageVersion>$(MicrosoftIdentityWebVersion)</PackageVersion>

<PackageType>Template</PackageType>
<PackageId>Microsoft.Identity.Web.ProjectTemplates</PackageId>
Expand Down
6 changes: 3 additions & 3 deletions ProjectTemplates/test-aspnet-templates-from-nuget.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
echo "Ensure ClientSemVer"
if "%ClientSemVer%" == "" (
set ClientSemVer=2.12.4
echo "Ensure MicrosoftIdentityWebVersion"
if "%MicrosoftIdentityWebVersion%" == "" (
set MicrosoftIdentityWebVersion=2.12.4
)

REM: This is to test Microsoft.Identity.Web templates
Expand Down
10 changes: 5 additions & 5 deletions ProjectTemplates/test-templates-from-nuget.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
echo "Ensure ClientSemVer"
if "%ClientSemVer%" == "" (
set ClientSemVer=2.12.4
echo "Ensure MicrosoftIdentityWebVersion"
if "%MicrosoftIdentityWebVersion%" == "" (
set MicrosoftIdentityWebVersion=2.12.4
)

REM: This is to test Microsoft.Identity.Web templates
Set TemplateNugetPackageName="Microsoft.Identity.Web.ProjectTemplates"
Set templatePostFix=2

REM: Uncomment the 3 following lines to test ASP.NET Core SDK templates
REM ClientSemVer="5.0.5.0.0-ci"
REM MicrosoftIdentityWebVersion="5.0.5.0.0-ci"
REM TemplateNugetPackageName="Microsoft.DotNet.Web.ProjectTemplates"
REM Set templatePostFix=

Expand All @@ -19,7 +19,7 @@ echo "Build and Install templates"
cd bin
cd Debug
dotnet new -u %TemplateNugetPackageName%
dotnet new -i %TemplateNugetPackageName%::%ClientSemVer%
dotnet new -i %TemplateNugetPackageName%::%MicrosoftIdentityWebVersion%

echo "Test templates"
mkdir tests
Expand Down
8 changes: 4 additions & 4 deletions ProjectTemplates/test-templates.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
echo "Ensure ClientSemVer"
if "%ClientSemVer%" == "" (
set ClientSemVer=2.12.4
echo "Ensure MicrosoftIdentityWebVersion"
if "%MicrosoftIdentityWebVersion%" == "" (
set MicrosoftIdentityWebVersion=2.12.4
)
Set TemplateNugetPackageName="Microsoft.Identity.Web.ProjectTemplates"

Expand All @@ -14,7 +14,7 @@ dotnet pack AspNetCoreMicrosoftIdentityWebProjectTemplates.csproj
cd bin
cd Debug
dotnet new -u %TemplateNugetPackageName%
dotnet new -i %TemplateNugetPackageName%.%ClientSemVer%.nupkg
dotnet new -i %TemplateNugetPackageName%.%MicrosoftIdentityWebVersion%.nupkg

echo "Test templates"
mkdir tests
Expand Down
12 changes: 6 additions & 6 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

In this article you will:

- Configure the version of the templates to test by setting the ClientSemVer environment variable.
- Configure the version of the templates to test by setting the MicrosoftIdentityWebVersion environment variable.
- Run a script that will:
- Generate C# projects corresponding to all the templates in various configurations (no auth, single-org, single-org calling graph, single-org calling web API, Individual B2C, Individual B2C calling web API (for the web API and the Blazorwasm hosted templates, as B2C does not support OBO)).
- Configure the projects with existing Azure AD and B2C apps and client secrets. This is done by a configuration file named `configuration.json`. You will need to add the client secrets (see below).
Expand All @@ -34,7 +34,7 @@ In a Developer Command Prompt:

3. Set the version of the templates to test.

`Set ClientSemVer=2.4.0`
`Set MicrosoftIdentityWebVersion=2.4.0`

4. In ProjectTemplates open the Configuration.json file and add the client secrets (or your own config file) .

Expand All @@ -50,16 +50,16 @@ In a Developer Command Prompt:

6. Copy the NuGet package containing the templates (Microsoft.Identity.Web.ProjectTemplates.version.nupkg) downloaded from the release build and paste it under the `ProjectTemplates\bin\Debug` folder of the repo.

The version should be the same as the value of `ClientSemVer` you set earlier. Also, if you downloaded the `Packages.zip` file from the AzureDevOps build and saved it in your Downloads folder before unzipping it, you could run the following command:
`copy "%UserProfile%\Downloads\Packages\Packages\Microsoft.Identity.Web.ProjectTemplates.%ClientSemVer%.nupkg" ProjectTemplates\bin\Debug`
The version should be the same as the value of `MicrosoftIdentityWebVersion` you set earlier. Also, if you downloaded the `Packages.zip` file from the AzureDevOps build and saved it in your Downloads folder before unzipping it, you could run the following command:
`copy "%UserProfile%\Downloads\Packages\Packages\Microsoft.Identity.Web.ProjectTemplates.%MicrosoftIdentityWebVersion%.nupkg" ProjectTemplates\bin\Debug`

7. Go to the ProjectTemplates folder `cd ProjectTemplates`

8. Ensure that the NuGet packages that will be restored in the test projects are the ones <b>generated from the release build</b>. For this you can select the corresponding folder in the Visual Studio NuGet package options UI, or just copy the <a href="https:/AzureAD/microsoft-identity-web/blob/master/ProjectTemplates/nuget.config.release-build">Nuget.config.release-build </a> file to nuget.config into the same folder:

`copy nuget.config.release-build nuget.config`

9. From ProjectTemplates folder, run the `Test-templates.bat` script with an argument to tell the script to pick-up the existing `Microsoft.Identity.Web.ProjectTemplates.%ClientSemVer%.nupkg` file instead of regenerating it.
9. From ProjectTemplates folder, run the `Test-templates.bat` script with an argument to tell the script to pick-up the existing `Microsoft.Identity.Web.ProjectTemplates.%MicrosoftIdentityWebVersion%.nupkg` file instead of regenerating it.

`Test-templates.bat DontGenerate`

Expand All @@ -73,7 +73,7 @@ In a Developer Command Prompt:

2. Set the version of the templates to test.

`Set ClientSemVer=2.4.0`
`Set MicrosoftIdentityWebVersion=2.4.0`

3. Add client secrets to the `ProjectTemplates\Configuration.json` file

Expand Down
2 changes: 1 addition & 1 deletion build/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- 'Azure Key Vault: buildautomation'
- 'Install Keyvault Secrets'

- [template-restore-build-MSIdentityWeb.yaml](template-restore-build-MSIdentityWeb.yaml) `(BuildPlatform:'$(BuildPlatform)', BuildConfiguration: '$(BuildConfiguration)', MsIdentityWebSemVer: $(MsIdentityWebSemVer))`
- [template-restore-build-MSIdentityWeb.yaml](template-restore-build-MSIdentityWeb.yaml) `(BuildPlatform:'$(BuildPlatform)', BuildConfiguration: '$(BuildConfiguration)', MicrosoftIdentityWebVersion: $(MicrosoftIdentityWebVersion))`
- Build solution Microsoft.Identity.Web.sln and run tests' (.NET Core)
- [Build](template-restore-build-MSIdentityWeb.yaml) solution Microsoft.Identity.Web.sln netcoreapp3.1 for Roslyn analyzers' (VSBuild@1)
- 'Component Detection'
Expand Down
4 changes: 2 additions & 2 deletions build/pipeline-releasebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ steps:
parameters:
BuildPlatform: '$(BuildPlatform)'
BuildConfiguration: '$(BuildConfiguration)'
MsIdentityWebSemVer: $(MsIdentityWebSemVer)
MicrosoftIdentityWebVersion: $(MicrosoftIdentityWebVersion)

# Run all tests
- template: template-run-unit-tests.yaml
parameters:
BuildPlatform: '$(BuildPlatform)'
BuildConfiguration: '$(BuildConfiguration)'
MsIdentityWebSemVer: $(MsIdentityWebSemVer)
MicrosoftIdentityWebVersion: $(MicrosoftIdentityWebVersion)

# Run Post-build code analysis (e.g. Roslyn)
- template: template-postbuild-code-analysis.yaml
Expand Down
4 changes: 2 additions & 2 deletions build/release-provisioning-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ steps:
inputs:
command: test
projects: '$(Build.SourcesDirectory)\tools\app-provisioning-tool\app-provisioning.sln'
arguments: '--configuration $(BuildConfiguration) -p:RunCodeAnalysis=true -p:ClientSemVer=$(ClientSemVer) -p:SourceLinkCreate=true'
arguments: '--configuration $(BuildConfiguration) -p:RunCodeAnalysis=true -p:MicrosoftIdentityWebVersion=$(MicrosoftIdentityWebVersion) -p:SourceLinkCreate=true'

# This task is needed so that the 1CS Rolsyn analyzers task works.
# The previous task does the restore
Expand All @@ -41,7 +41,7 @@ steps:
inputs:
solution: '$(Build.SourcesDirectory)\tools\app-provisioning-tool\app-provisioning.sln'
vsVersion: '16.0'
msbuildArgs: '/p:RunCodeAnalysis=false /p:ClientSemVer=$(ClientSemVer) /p:SourceLinkCreate=true'
msbuildArgs: '/p:RunCodeAnalysis=false /p:MicrosoftIdentityWebVersion=$(MicrosoftIdentityWebVersion) /p:SourceLinkCreate=true'
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)

Expand Down
4 changes: 2 additions & 2 deletions build/template-onebranch-release-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
parameters:
BuildPlatform: 'any cpu'
BuildConfiguration: 'release'
MsIdentityWebSemVer: '1.0.0-internal$(Build.BuildNumber)'
MicrosoftIdentityWebVersion: '1.0.0-internal$(Build.BuildNumber)'

steps:

Expand All @@ -15,7 +15,7 @@ steps:
parameters:
BuildPlatform: '$(BuildPlatform)'
BuildConfiguration: '$(BuildConfiguration)'
MsIdentityWebSemVer: $(MsIdentityWebSemVer)
MicrosoftIdentityWebVersion: $(MicrosoftIdentityWebVersion)

# Pack and sign all of the nuget packages
- template: template-pack-and-sign-all-nugets.yaml
Expand Down
6 changes: 3 additions & 3 deletions build/template-restore-build-MSIdentityWeb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
parameters:
BuildPlatform: 'any cpu'
BuildConfiguration: 'debug'
MsIdentityWebSemVer: '1.0.0-devopsbuild'
MicrosoftIdentityWebVersion: '1.0.0-devopsbuild'

steps:
- script: |
Expand All @@ -17,7 +17,7 @@ steps:
command: 'custom'
custom: 'build'
projects: '$(IdWebSourceDir)Microsoft.Identity.Web.sln'
arguments: '-p:configuration=${{ parameters.BuildConfiguration }} -p:RunCodeAnalysis=true -p:MicrosoftIdentityWebVersion=${{ parameters.MsIdentityWebSemVer }} -p:SourceLinkCreate=true'
arguments: '-p:configuration=${{ parameters.BuildConfiguration }} -p:RunCodeAnalysis=true -p:MicrosoftIdentityWebVersion=${{ parameters.MicrosoftIdentityWebVersion }} -p:SourceLinkCreate=true'

# This task is needed so that the 1CS Rolsyn analyzers task works.
# The previous task does the restore
Expand All @@ -28,7 +28,7 @@ steps:
command: custom
custom: msbuild
project: '$(IdWebSourceDir)Microsoft.Identity.Web.sln'
arguments: '-p:configuration=${{ parameters.BuildConfiguration }} -p:RunCodeAnalysis=false -p:MicrosoftIdentityWebVersion=${{ parameters.MsIdentityWebSemVer }} -p:SourceLinkCreate=true'
arguments: '-p:configuration=${{ parameters.BuildConfiguration }} -p:RunCodeAnalysis=false -p:MicrosoftIdentityWebVersion=${{ parameters.MicrosoftIdentityWebVersion }} -p:SourceLinkCreate=true'

# Run the dotnet daemon app
# This requires that the build machine has a user assigned managed identity that can access the KeyVault.
Expand Down

0 comments on commit 23f6d94

Please sign in to comment.