From d7db13c788bd0c3aa42d32d2197fa3e8f2582e9d Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 18 Oct 2024 15:11:01 -0700 Subject: [PATCH 1/5] Fix build --- build/template-install-dependencies.yaml | 12 +++++------- build/template-onebranch-release-build.yaml | 2 -- build/template-pack-nuget.yaml | 2 -- build/template-restore-build-MSIdentityWeb.yaml | 17 +++++++++-------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/build/template-install-dependencies.yaml b/build/template-install-dependencies.yaml index 415217436..d092faa56 100644 --- a/build/template-install-dependencies.yaml +++ b/build/template-install-dependencies.yaml @@ -1,6 +1,4 @@ #template-install-dependencies.yaml -parameters: - authenticateForFeed: 'true' #install dotnet core @@ -46,11 +44,11 @@ steps: KeyVaultName: 'msidlabs' SecretsFilter: 'LabAuth' -- task: NuGetAuthenticate@1 - displayName: NuGet Authenticate - condition: eq('${{ parameters.authenticateForFeed }}', 'true') - inputs: - nuGetServiceConnections: 'IDDP Feed' +# - task: NuGetAuthenticate@1 +# displayName: NuGet Authenticate +# condition: eq('${{ parameters.authenticateForFeed }}', 'true') +# inputs: +# nuGetServiceConnections: 'IDDP Feed' - powershell: | $kvSecretBytes = [System.Convert]::FromBase64String('$(LabAuth)') diff --git a/build/template-onebranch-release-build.yaml b/build/template-onebranch-release-build.yaml index 76bc2301a..302a76ad2 100644 --- a/build/template-onebranch-release-build.yaml +++ b/build/template-onebranch-release-build.yaml @@ -9,8 +9,6 @@ steps: # Bootstrap the build - template: template-install-dependencies.yaml - parameters: - authenticateForFeed: 'false' # Nuget Restore and Build Microsoft.Identity.Web.sln - template: template-restore-build-MSIdentityWeb.yaml diff --git a/build/template-pack-nuget.yaml b/build/template-pack-nuget.yaml index e5a09651a..ae3881cf0 100644 --- a/build/template-pack-nuget.yaml +++ b/build/template-pack-nuget.yaml @@ -16,8 +16,6 @@ steps: nobuild: '${{parameters.NoBuild}}' packagesToPack: '${{ parameters.ProjectRootPath }}\${{ parameters.AssemblyName }}.csproj' IncludeSymbols: true - feedsToUse: 'config' - nugetConfigPath: NuGet.config verbosityPack: normal packDirectory: arguments: '--configuration ${{ parameters.BuildConfiguration }}' diff --git a/build/template-restore-build-MSIdentityWeb.yaml b/build/template-restore-build-MSIdentityWeb.yaml index 05dd3fa0f..77aeb1526 100644 --- a/build/template-restore-build-MSIdentityWeb.yaml +++ b/build/template-restore-build-MSIdentityWeb.yaml @@ -11,13 +11,16 @@ steps: dotnet workload restore $(IdWebSourceDir)tests\DevApps\blazorwasm-b2c\blazorwasm2-b2c.csproj displayName: 'Install wasm-tools' -- task: NuGetAuthenticate@1 - displayName: NuGet Authenticate - inputs: - nuGetServiceConnections: 'IDDP Feed' +# - task: NuGetAuthenticate@1 +# displayName: NuGet Authenticate +# inputs: +# nuGetServiceConnections: 'IDDP Feed' + +- script: dotnet nuget remove source NuGet + displayName: 'Remove external "NuGet" Source' -- script: dotnet nuget update source NuGet --source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json --configfile "$(Build.SourcesDirectory)\Nuget.config" - displayName: 'Add NuGet Source for MISE' +- script: dotnet nuget add source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json -n IDDP + displayName: 'Add IDDP artifacts as NuGet Source' - task: DotNetCoreCLI@2 displayName: 'Build solution Microsoft.Identity.Web.sln' @@ -25,8 +28,6 @@ steps: command: 'custom' custom: 'build' projects: '$(IdWebSourceDir)Microsoft.Identity.Web.sln' - feedsToUse: 'config' - nugetConfigPath: NuGet.config 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. From a6e04df6a32342f628a832c3b7219d3607e6cb9f Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 18 Oct 2024 15:26:11 -0700 Subject: [PATCH 2/5] Nuget authenticate without source --- build/template-install-dependencies.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/build/template-install-dependencies.yaml b/build/template-install-dependencies.yaml index d092faa56..e9897c267 100644 --- a/build/template-install-dependencies.yaml +++ b/build/template-install-dependencies.yaml @@ -44,11 +44,8 @@ steps: KeyVaultName: 'msidlabs' SecretsFilter: 'LabAuth' -# - task: NuGetAuthenticate@1 -# displayName: NuGet Authenticate -# condition: eq('${{ parameters.authenticateForFeed }}', 'true') -# inputs: -# nuGetServiceConnections: 'IDDP Feed' +- task: NuGetAuthenticate@1 + displayName: NuGet Authenticate - powershell: | $kvSecretBytes = [System.Convert]::FromBase64String('$(LabAuth)') From bc32b4aaf4ba63372baf1116cd7981e4d04af18e Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 18 Oct 2024 15:31:28 -0700 Subject: [PATCH 3/5] resilience to jobs --- build/template-restore-build-MSIdentityWeb.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/template-restore-build-MSIdentityWeb.yaml b/build/template-restore-build-MSIdentityWeb.yaml index 77aeb1526..f43787853 100644 --- a/build/template-restore-build-MSIdentityWeb.yaml +++ b/build/template-restore-build-MSIdentityWeb.yaml @@ -18,9 +18,11 @@ steps: - script: dotnet nuget remove source NuGet displayName: 'Remove external "NuGet" Source' + continueOnError: true # could have been run already in a different job on the same machine - script: dotnet nuget add source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json -n IDDP displayName: 'Add IDDP artifacts as NuGet Source' + continueOnError: true # could have been run already in a different job on the same machine - task: DotNetCoreCLI@2 displayName: 'Build solution Microsoft.Identity.Web.sln' From a453c8f0889ce3cefc622b996bc2ec96edbf003d Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 18 Oct 2024 16:24:22 -0700 Subject: [PATCH 4/5] Cleaner way to remove the external feed and add the internal one --- .../template-restore-build-MSIdentityWeb.yaml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/build/template-restore-build-MSIdentityWeb.yaml b/build/template-restore-build-MSIdentityWeb.yaml index f43787853..b7c92fddd 100644 --- a/build/template-restore-build-MSIdentityWeb.yaml +++ b/build/template-restore-build-MSIdentityWeb.yaml @@ -11,18 +11,13 @@ steps: dotnet workload restore $(IdWebSourceDir)tests\DevApps\blazorwasm-b2c\blazorwasm2-b2c.csproj displayName: 'Install wasm-tools' -# - task: NuGetAuthenticate@1 -# displayName: NuGet Authenticate -# inputs: -# nuGetServiceConnections: 'IDDP Feed' - -- script: dotnet nuget remove source NuGet - displayName: 'Remove external "NuGet" Source' - continueOnError: true # could have been run already in a different job on the same machine - -- script: dotnet nuget add source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json -n IDDP - displayName: 'Add IDDP artifacts as NuGet Source' - continueOnError: true # could have been run already in a different job on the same machine +- powershell: | + $nugetSourceIsExternal = (dotnet nuget list source --format Short).Contains("https://api.nuget.org/v3/index.json") + if ($nugetSourceIsExternal) { + dotnet nuget remove source NuGet + dotnet nuget add source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json -n IDDP + } + displayName: 'Remove external "NuGet" Source and add "IDDP artifacts" as a NuGet Source, if needed.' - task: DotNetCoreCLI@2 displayName: 'Build solution Microsoft.Identity.Web.sln' From 454e152a7ad0bd967582a9b27f1a0268273de12b Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 18 Oct 2024 16:37:50 -0700 Subject: [PATCH 5/5] Adding a display --- build/template-restore-build-MSIdentityWeb.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/build/template-restore-build-MSIdentityWeb.yaml b/build/template-restore-build-MSIdentityWeb.yaml index b7c92fddd..d4bfd7814 100644 --- a/build/template-restore-build-MSIdentityWeb.yaml +++ b/build/template-restore-build-MSIdentityWeb.yaml @@ -16,6 +16,7 @@ steps: if ($nugetSourceIsExternal) { dotnet nuget remove source NuGet dotnet nuget add source https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json -n IDDP + dotnet nuget list source } displayName: 'Remove external "NuGet" Source and add "IDDP artifacts" as a NuGet Source, if needed.'