Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rollout] Production rollout 2025-02-05 #4417

Merged
merged 6 commits into from
Feb 5, 2025
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"microsoft.dnceng.secretmanager": {
"version": "1.1.0-beta.25071.2",
"version": "1.1.0-beta.25079.1",
"commands": [
"secret-manager"
]
Expand All @@ -15,7 +15,7 @@
]
},
"microsoft.dnceng.configuration.bootstrap": {
"version": "1.1.0-beta.25071.2",
"version": "1.1.0-beta.25079.1",
"commands": [
"bootstrap-dnceng-configuration"
]
Expand Down
32 changes: 16 additions & 16 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,37 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.SignTool" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.SignTool" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Git.IssueManager" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.Git.IssueManager" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.VersionTools" Version="8.0.0-beta.25066.6">
<Dependency Name="Microsoft.DotNet.VersionTools" Version="8.0.0-beta.25079.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4db725213dccb0d1102427bce1c39ba3117da7f7</Sha>
<Sha>cae548d41ddb92922d78f3d9737635d104f650a5</Sha>
</Dependency>
<Dependency Name="Microsoft.DncEng.SecretManager" Version="1.1.0-beta.25071.2">
<Dependency Name="Microsoft.DncEng.SecretManager" Version="1.1.0-beta.25079.1">
<Uri>https://github.com/dotnet/dnceng</Uri>
<Sha>919c3cbb47ad56b61ba59e3f0ccf6555d4607c7e</Sha>
<Sha>a2f07fa3c2454f47998e7c48652ea91982362a74</Sha>
</Dependency>
<Dependency Name="Microsoft.DncEng.Configuration.Bootstrap" Version="1.1.0-beta.25071.2">
<Dependency Name="Microsoft.DncEng.Configuration.Bootstrap" Version="1.1.0-beta.25079.1">
<Uri>https://github.com/dotnet/dnceng</Uri>
<Sha>919c3cbb47ad56b61ba59e3f0ccf6555d4607c7e</Sha>
<Sha>a2f07fa3c2454f47998e7c48652ea91982362a74</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
14 changes: 7 additions & 7 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.0-preview.1</MicrosoftNetFrameworkReferenceAssembliesVersion>
<!-- Libs -->
<MicrosoftDotNetSignToolVersion>8.0.0-beta.25066.6</MicrosoftDotNetSignToolVersion>
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.25066.6</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>8.0.0-beta.25066.6</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
<MicrosoftDotNetGitIssueManagerVersion>8.0.0-beta.25066.6</MicrosoftDotNetGitIssueManagerVersion>
<MicrosoftDotNetVersionToolsVersion>8.0.0-beta.25066.6</MicrosoftDotNetVersionToolsVersion>
<MicrosoftDotNetSignToolVersion>8.0.0-beta.25079.1</MicrosoftDotNetSignToolVersion>
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.25079.1</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>8.0.0-beta.25079.1</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
<MicrosoftDotNetGitIssueManagerVersion>8.0.0-beta.25079.1</MicrosoftDotNetGitIssueManagerVersion>
<MicrosoftDotNetVersionToolsVersion>8.0.0-beta.25079.1</MicrosoftDotNetVersionToolsVersion>
<MicrosoftNetTestSdkVersion>17.4.1</MicrosoftNetTestSdkVersion>
<MicrosoftDotNetInternalLoggingVersion>1.1.0-beta.25080.1</MicrosoftDotNetInternalLoggingVersion>
<MicrosoftAspNetCoreApiPaginationVersion>1.1.0-beta.25080.1</MicrosoftAspNetCoreApiPaginationVersion>
Expand All @@ -32,8 +32,8 @@
<MicrosoftDotNetMetricsVersion>1.1.0-beta.25052.1</MicrosoftDotNetMetricsVersion>
<MicrosoftDotNetServicesUtilityVersion>1.1.0-beta.25080.1</MicrosoftDotNetServicesUtilityVersion>
<MicrosoftDotNetWebAuthenticationVersion>1.1.0-beta.25053.1</MicrosoftDotNetWebAuthenticationVersion>
<MicrosoftDncEngSecretManagerVersion>1.1.0-beta.25071.2</MicrosoftDncEngSecretManagerVersion>
<MicrosoftDncEngConfigurationBootstrapVersion>1.1.0-beta.25071.2</MicrosoftDncEngConfigurationBootstrapVersion>
<MicrosoftDncEngSecretManagerVersion>1.1.0-beta.25079.1</MicrosoftDncEngSecretManagerVersion>
<MicrosoftDncEngConfigurationBootstrapVersion>1.1.0-beta.25079.1</MicrosoftDncEngConfigurationBootstrapVersion>
</PropertyGroup>
<!--Package names-->
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25066.6"
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25079.1"
}
}
18 changes: 6 additions & 12 deletions src/Microsoft.DotNet.Darc/Darc/Helpers/LocalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.IO;
using Microsoft.DotNet.Darc.Options;
using Microsoft.DotNet.ProductConstructionService.Client;
using Microsoft.Extensions.Logging;
Expand All @@ -14,11 +15,6 @@ namespace Microsoft.DotNet.Darc.Helpers;
/// </summary>
internal class LocalSettings
{
public string BuildAssetRegistryToken { get; set; }

// Old way of storing the settings had the password and not the token so we keep both to deserialize these correctly.
public string BuildAssetRegistryPassword { get; set; }

public string GitHubToken { get; set; }

public string AzureDevOpsToken { get; set; }
Expand Down Expand Up @@ -55,6 +51,11 @@ public static LocalSettings GetSettings(ICommandLineOptions options, ILogger log
{
localSettings = LoadSettingsFile();
}
catch (FileNotFoundException)
{
// User has not called darc authenticate yet
// Not a problem of it self unless the operation they run needs the GitHub token
}
catch (Exception e)
{
if (!options.IsCi && options.OutputFormat != DarcOutputType.json)
Expand All @@ -71,15 +72,8 @@ static string PreferOptionToSetting(string option, string localSetting)
// Prefer the command line options over the settings file
localSettings ??= new LocalSettings();

if (string.IsNullOrEmpty(localSettings.BuildAssetRegistryToken))
{
// Old way of storing the settings had the password and not the token
localSettings.BuildAssetRegistryToken = localSettings.BuildAssetRegistryPassword;
}

localSettings.AzureDevOpsToken = PreferOptionToSetting(options.AzureDevOpsPat, localSettings.AzureDevOpsToken);
localSettings.GitHubToken = PreferOptionToSetting(options.GitHubPat, localSettings.GitHubToken);
localSettings.BuildAssetRegistryToken = PreferOptionToSetting(options.BuildAssetRegistryToken, localSettings.BuildAssetRegistryToken);
localSettings.BuildAssetRegistryBaseUri = options.BuildAssetRegistryBaseUri
?? localSettings.BuildAssetRegistryBaseUri
?? ProductConstructionServiceApiOptions.ProductionMaestroUri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ internal class AuthenticateEditorPopUp : EditorPopUp
{
private readonly ILogger _logger;

private const string BarPasswordElement = "bar_password";
private const string GithubTokenElement = "github_token";
private const string AzureDevOpsTokenElement = "azure_devops_token";
private const string BarBaseUriElement = "build_asset_registry_base_uri";
Expand All @@ -40,12 +39,6 @@ public AuthenticateEditorPopUp(string path, ILogger logger)
// Initialize line contents.
Contents =
[
new("[DEPRECATED]", isComment: true),
new("BAR tokens (formerly created at https://maestro.dot.net/Account/Tokens) are now deprecated.", isComment: true),
new("Interactive sign-in through a security group is now enabled.", isComment: true),
new("See https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#setting-up-your-darc-client for more information.", isComment: true),
new($"{BarPasswordElement}={GetCurrentSettingForDisplay(settings.BuildAssetRegistryToken, string.Empty, true)}"),
new(string.Empty),
new("Create new GitHub personal access tokens at https://github.com/settings/tokens (no scopes needed but needs SSO enabled on the PAT)", isComment: true),
new($"{GithubTokenElement}={GetCurrentSettingForDisplay(settings.GitHubToken, string.Empty, true)}"),
new(string.Empty),
Expand All @@ -72,15 +65,6 @@ public override Task<int> ProcessContents(IList<Line> contents)

switch (keyValue[0])
{
case BarPasswordElement:
settings.BuildAssetRegistryToken = ParseSetting(keyValue[1], settings.BuildAssetRegistryToken, true);

if (!string.IsNullOrEmpty(settings.BuildAssetRegistryToken))
{
_logger.LogWarning("BAR password is being deprecated and will stop working soon.");
}

break;
case GithubTokenElement:
settings.GitHubToken = ParseSetting(keyValue[1], settings.GitHubToken, true);
break;
Expand Down
15 changes: 12 additions & 3 deletions src/Microsoft.DotNet.Darc/Darc/Options/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ public override Operation GetOperation(ServiceProvider sp)
public abstract class CommandLineOptions : ICommandLineOptions
{
[Option('p', "password",
HelpText = "Token used to authenticate to BAR. If it or the federated token are omitted, auth falls back to Azure CLI or an interactive browser login flow.")]
HelpText = "[DEPRECATED] Token used to authenticate to BAR. Please use Azure CLI or an interactive browser login flow.")]
[RedactFromLogging]
public string BuildAssetRegistryToken { get; set; }
public string BuildAssetRegistryToken
{
get => null;
set
{
if (!string.IsNullOrEmpty(value))
{
Console.WriteLine("The --password option is deprecated. Please use Azure CLI or an interactive browser login flow.");
}
}
}

[Option("github-pat", HelpText = "Token used to authenticate GitHub.")]
[RedactFromLogging]
Expand Down Expand Up @@ -106,7 +116,6 @@ public void InitializeFromSettings(ILogger logger)
AzureDevOpsPat ??= localSettings.AzureDevOpsToken;
GitHubPat ??= localSettings.GitHubToken;
BuildAssetRegistryBaseUri ??= localSettings.BuildAssetRegistryBaseUri;
BuildAssetRegistryToken ??= localSettings.BuildAssetRegistryToken;
}

/// <summary>
Expand Down
84 changes: 82 additions & 2 deletions src/Microsoft.DotNet.Darc/DarcLib/Helpers/DependencyFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,86 @@ public async Task AddDependencyAsync(
await AddDependencyToVersionDetailsAsync(repoUri, branch, dependency);
}

public async Task RemoveDependencyAsync(DependencyDetail dependency, string repoUri, string branch, bool repoIsVmr = false)
{
var updatedDependencyVersionFile =
new GitFile(VersionFiles.VersionDetailsXml, await RemoveDependencyFromVersionDetailsAsync(dependency, repoUri, branch));
var updatedVersionPropsFile =
new GitFile(VersionFiles.VersionProps, await RemoveDependencyFromVersionPropsAsync(dependency, repoUri, branch));
List<GitFile> gitFiles = [updatedDependencyVersionFile, updatedVersionPropsFile];

var updatedDotnetTools = await RemoveDotnetToolsDependencyAsync(dependency, repoUri, branch, repoIsVmr);
if (updatedDotnetTools != null)
{
gitFiles.Add(new(VersionFiles.DotnetToolsConfigJson, updatedDotnetTools));
}

await GetGitClient(repoUri).CommitFilesAsync(
gitFiles,
repoUri,
branch,
$"Remove {dependency.Name} from Version.Details.xml and Version.props'");

_logger.LogInformation($"Dependency '{dependency.Name}' successfully removed from '{VersionFiles.VersionDetailsXml}'");
}

private async Task<JObject> RemoveDotnetToolsDependencyAsync(DependencyDetail dependency, string repoUri, string branch, bool repoIsVmr)
{
var dotnetTools = await ReadDotNetToolsConfigJsonAsync(repoUri, branch, repoIsVmr);

if (dotnetTools == null)
{
return null;
}

if (dotnetTools["tools"] is not JObject tools)
{
return null;
}

// we have to do this because JObject is case sensitive
var toolProperty = tools.Properties().FirstOrDefault(p => p.Name.Equals(dependency.Name, StringComparison.OrdinalIgnoreCase));
if (toolProperty != null)
{
tools.Remove(toolProperty.Name);
}

return dotnetTools;
}

private async Task<XmlDocument> RemoveDependencyFromVersionPropsAsync(DependencyDetail dependency, string repoUri, string branch)
{
var versionProps = await ReadVersionPropsAsync(repoUri, branch);
string nodeName = VersionFiles.GetVersionPropsPackageVersionElementName(dependency.Name);
XmlNode element = versionProps.SelectSingleNode($"//{nodeName}");
if (element == null)
{
string alternateNodeName = VersionFiles.GetVersionPropsAlternatePackageVersionElementName(dependency.Name);
element = versionProps.SelectSingleNode($"//{alternateNodeName}");
if (element == null)
{
throw new DependencyException($"Couldn't find dependency {dependency.Name} in Version.props");
}
}
element.ParentNode.RemoveChild(element);

return versionProps;
}

private async Task<XmlDocument> RemoveDependencyFromVersionDetailsAsync(DependencyDetail dependency, string repoUri, string branch)
{
var versionDetails = await ReadVersionDetailsXmlAsync(repoUri, branch);
XmlNode dependencyNode = versionDetails.SelectSingleNode($"//{VersionDetailsParser.DependencyElementName}[@Name='{dependency.Name}']");

if (dependencyNode == null)
{
throw new DependencyException($"Dependency {dependency.Name} not found in Version.Details.xml");
}

dependencyNode.ParentNode.RemoveChild(dependencyNode);
return versionDetails;
}

private static void SetAttribute(XmlDocument document, XmlNode node, string name, string value)
{
XmlAttribute attribute = node.Attributes[name];
Expand Down Expand Up @@ -805,8 +885,8 @@ private async Task AddDependencyToVersionsPropsAsync(string repo, string branch,

// Attempt to find the element name or alternate element name under
// the property group nodes
XmlNode existingVersionNode = versionProps.DocumentElement.SelectSingleNode($"//*[local-name()='{packageVersionElementName}' and parent::PropertyGroup]");
existingVersionNode ??= versionProps.DocumentElement.SelectSingleNode($"//*[local-name()='{packageVersionAlternateElementName}' and parent::PropertyGroup]");
XmlNode existingVersionNode = versionProps.DocumentElement.SelectSingleNode($"//*[local-name()='{packageVersionElementName}' and parent::PropertyGroup]")
?? versionProps.DocumentElement.SelectSingleNode($"//*[local-name()='{packageVersionAlternateElementName}' and parent::PropertyGroup]");

if (existingVersionNode != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public interface IDependencyFileManager
{
Task AddDependencyAsync(DependencyDetail dependency, string repoUri, string branch);

Task RemoveDependencyAsync(DependencyDetail dependency, string repoUri, string branch, bool repoIsVmr = false);

Dictionary<string, HashSet<string>> FlattenLocationsAndSplitIntoGroups(Dictionary<string, HashSet<string>> assetLocationMap);

List<(string key, string feed)> GetPackageSources(XmlDocument nugetConfig, Func<string, bool>? filter = null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ await app.Services.UseLocalWorkItemQueues([
};
});

app.UseHttpLogging();

await app.SetWorkItemProcessorInitialState();

app.Run();
Loading