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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"microsoft.dnceng.secretmanager": {
"version": "1.1.0-beta.23314.3",
"version": "1.1.0-beta.23328.1",
"commands": [
"secret-manager"
]
Expand All @@ -21,7 +21,7 @@
]
},
"microsoft.dnceng.configuration.bootstrap": {
"version": "1.1.0-beta.23314.3",
"version": "1.1.0-beta.23328.1",
"commands": [
"bootstrap-dnceng-configuration"
]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageVersion Include="FluentAssertions.Json" Version="5.5.0" />
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
<PackageVersion Include="JetBrains.Annotations" Version="11.1.0" PrivateAssets="All" />
<PackageVersion Include="LibGit2Sharp" Version="0.27.0-preview-0175" />
<PackageVersion Include="LibGit2Sharp" Version="0.27.2" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="5.2.6" />
<PackageVersion Include="Microsoft.AspNetCore.ApiPagination" Version="$(MicrosoftAspNetCoreApiPaginationVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.ApiVersioning" Version="$(MicrosoftAspNetCoreApiVersioningVersion)" />
Expand Down
2 changes: 1 addition & 1 deletion azure-pipeline-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ appendCommitMessageToRunName: false
trigger: none

schedules:
- cron: 0 12 * * 1
- cron: 0 6 * * 1
displayName: Weekly Monday build
branches:
include:
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ stages:
vmImage: windows-latest
steps:
- checkout: self
- powershell: eng/enforce-issue.ps1 -PullRequestNumber $(System.PullRequest.PullRequestNumber)
- powershell: eng/enforce-issue.ps1 -PullRequestNumber $(System.PullRequest.PullRequestNumber) -RepositoryName $(Build.Repository.Name)
displayName: Enforce GitHub issue link presence

- stage: build
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>91616785a1a6578c83f7e93d98c34a1eb83d6223</Sha>
</Dependency>
<Dependency Name="Microsoft.DncEng.SecretManager" Version="1.1.0-beta.23314.3">
<Dependency Name="Microsoft.DncEng.SecretManager" Version="1.1.0-beta.23328.1">
<Uri>https://github.com/dotnet/dnceng</Uri>
<Sha>7aa26710c692db98889df5a7d33be28454e7fab4</Sha>
<Sha>98e5d1f8fb3b07fc4cacf0db83e1582aa2255246</Sha>
</Dependency>
<Dependency Name="Microsoft.DncEng.Configuration.Bootstrap" Version="1.1.0-beta.23314.3">
<Dependency Name="Microsoft.DncEng.Configuration.Bootstrap" Version="1.1.0-beta.23328.1">
<Uri>https://github.com/dotnet/dnceng</Uri>
<Sha>7aa26710c692db98889df5a7d33be28454e7fab4</Sha>
<Sha>98e5d1f8fb3b07fc4cacf0db83e1582aa2255246</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<MicrosoftDotNetWebAuthenticationVersion>1.1.0-beta.23314.1</MicrosoftDotNetWebAuthenticationVersion>
<ServiceFabricMocksVersion>1.1.0-beta.23314.1</ServiceFabricMocksVersion>
<CoreHealthMonitorVersion>1.1.0-beta.23314.1</CoreHealthMonitorVersion>
<MicrosoftDncEngSecretManagerVersion>1.1.0-beta.23314.3</MicrosoftDncEngSecretManagerVersion>
<MicrosoftDncEngConfigurationBootstrapVersion>1.1.0-beta.23314.3</MicrosoftDncEngConfigurationBootstrapVersion>
<MicrosoftDncEngSecretManagerVersion>1.1.0-beta.23328.1</MicrosoftDncEngSecretManagerVersion>
<MicrosoftDncEngConfigurationBootstrapVersion>1.1.0-beta.23328.1</MicrosoftDncEngConfigurationBootstrapVersion>
</PropertyGroup>
<!--Package names-->
<PropertyGroup>
Expand Down
40 changes: 27 additions & 13 deletions eng/enforce-issue.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[CmdletBinding()]
param (
[Parameter(Mandatory = $True)]
$PullRequestNumber
$PullRequestNumber,
[Parameter(Mandatory = $True)]
$RepositoryName
)

function HasReleaseNotes($description) {
return $description -Match "### Release Note Description(?:\r?\n)+([^\s]+)"
}

$prDetail = Invoke-WebRequest `
-UseBasicParsing `
-Uri "https://api.github.com/repos/dotnet/arcade-services/pulls/$PullRequestNumber" `
| ConvertFrom-Json
-UseBasicParsing `
-Uri "https://api.github.com/repos/$RepositoryName/pulls/$PullRequestNumber" `
| ConvertFrom-Json

if ($prDetail.draft) {
Write-Host "Draft PR does not have to have GitHub issue specified. Check passed."
Expand All @@ -28,6 +34,12 @@ if (-not $hasIssue) {
exit 1
}

if (HasReleaseNotes $prDetail.body) {
Write-Host "PR has release notes in the description. Check passed."
exit 0
}


try {
$issueDetail = Invoke-WebRequest `
-UseBasicParsing `
Expand All @@ -39,16 +51,18 @@ catch {
exit 1
}

$issueHasReleaseNotes = $issueDetail.body -Match "### Release Note Description(?:\r?\n)+([^\s]+)"
$issueIsAzdoMirror = $issueDetail.title -like "AzDO Issue*"
if (-not $issueHasReleaseNotes -and -not $issueIsAzdoMirror) {
Write-Host "##vso[task.LogIssue type=error;]Linked GitHub issue does not have release notes. Check failed."
Write-Host "Ensure your issue has release notes. They should be in the following format:`n`n### Release Note Description`n<Stick your notes here>`n"
Write-Host "For more information, see https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/983/ReleaseNotesGuidance?anchor=mechanics"
exit 1
if (HasReleaseNotes $issueDetail.body) {
Write-Host "PR links a GitHub issue with release notes. Check passed."
exit 0
}
elseif ($issueIsAzdoMirror) {

$issueIsAzdoMirror = $issueDetail.title -like "AzDO Issue*"
if ($issueIsAzdoMirror) {
Write-Host "##vso[task.LogIssue type=warning;]Linked GitHub issue is a mirrored Azure DevOps workitem. Please ensure the workitem has release notes in it."
exit 0
}

Write-Host "PR links a GitHub issue. Check passed."
Write-Host "##vso[task.LogIssue type=error;]Linked GitHub issue does not have release notes. Check failed."
Write-Host "Ensure your issue has release notes. They should be in the following format:`n`n### Release Note Description`n<Stick your notes here>`n"
Write-Host "For more information, see https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/983/ReleaseNotesGuidance?anchor=mechanics"
exit 1
18 changes: 11 additions & 7 deletions src/Maestro/Maestro.DataProviders/SharedKustoQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,41 @@ public static MultiProjectKustoQuery CreateBuildTimesQueries(

Uri uri = new Uri(repository);

// Builds in AzDo are only found in the internal project
// Builds in AzDo are only found in the internal project.
if (uri.Host == "dev.azure.com")
{
prProject = "internal";
}

// We only care about builds that complete successfully or partially successfully
// from the given repository. We summarize duration of the builds over the last specified
// number of days. There are multiple different definitions that run in parallel, so we
// number of days.
string commonQueryFilters = @"| where FinishTime > ago(_Days)
| where Result !in('failed', 'canceled')";

// There are multiple different definitions that run in parallel, so we
// summarize on the definition id and ultimately choose the definition that took the longest.
string commonQueryText = @"| where Result != 'failed' and Result != 'canceled'
| where FinishTime > ago(_Days)
| extend duration = FinishTime - StartTime
string postFilteringOperatorsQueryText = @"| extend duration = FinishTime - StartTime
| summarize average_duration = avg(duration) by DefinitionId";

// We only want the pull request time from the public ci. We exclude on target branch,
// as all PRs come in as refs/heads/#/merge rather than what branch they are trying to
// apply to.
string publicQueryText = $@"TimelineBuilds
| project Repository, SourceBranch, TargetBranch, DefinitionId, StartTime, FinishTime, Result, Project, Reason
{commonQueryFilters}
| where Project == '{prProject}'
| where Repository endswith _Repository
| where Reason == 'pullRequest'
| where TargetBranch == _SourceBranch
{commonQueryText}";
{postFilteringOperatorsQueryText}";

// For the official build times, we want the builds that were generated as a CI run
// (either batchedCI or individualCI) for a specific branch--i.e. we want the builds
// that are part of generating the product.
string internalQueryText = $@"TimelineBuilds
| project Repository, SourceBranch, DefinitionId, StartTime, FinishTime, Result, Project, Reason
{commonQueryFilters}
| where Project == 'internal'
| where Repository endswith _Repository
| where Reason == 'batchedCI' or Reason == 'individualCI' or Reason == 'manual'
Expand All @@ -77,7 +81,7 @@ public static MultiProjectKustoQuery CreateBuildTimesQueries(
}

internalQueryText += $@"
{commonQueryText}";
{postFilteringOperatorsQueryText}";

return new MultiProjectKustoQuery(new KustoQuery(internalQueryText, parameters), new KustoQuery(publicQueryText, parameters));
}
Expand Down
28 changes: 22 additions & 6 deletions src/Microsoft.DotNet.Darc/Darc/Operations/GetAssetOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.DotNet.Darc.Operations;
Expand Down Expand Up @@ -46,16 +47,31 @@ public override async Task<int> ExecuteAsync()

// Starting with the remote, get information on the asset name + version
List<Asset> matchingAssets =
(await remote.GetAssetsAsync(name: _options.Name, version: _options.Version)).ToList();
(await remote.GetAssetsAsync(name: _options.Name, version: _options.Version, buildId: _options.Build)).ToList();

string queryDescriptionString =
$"name '{_options.Name}'{(!string.IsNullOrEmpty(_options.Version) ? $" and version '{_options.Version}'" : "")}" +
$"{(targetChannel != null ? $" on channel '{targetChannel.Name}'" : "")} in the last {_options.MaxAgeInDays} days";
var queryDescription = new StringBuilder($"name '{_options.Name}'");

if (!string.IsNullOrEmpty(_options.Version))
{
queryDescription.Append($" and version '{_options.Version}'");
}

if (targetChannel != null)
{
queryDescription.Append($" on channel '{targetChannel.Name}'");
}

if (_options.Build != null)
{
queryDescription.Append($" from build '{_options.Build}'");
}

queryDescription.Append($" in the last {_options.MaxAgeInDays} days");

// Only print the lookup string if the output type is text.
if (_options.OutputFormat == DarcOutputType.text)
{
Console.WriteLine($"Looking up assets with {queryDescriptionString}");
Console.WriteLine($"Looking up assets with {queryDescription}");
}

// Walk the assets and look up the corresponding builds, potentially filtering based on channel
Expand Down Expand Up @@ -88,7 +104,7 @@ public override async Task<int> ExecuteAsync()

if (!matchingAssetsAfterDate.Any())
{
Console.WriteLine($"No assets found with {queryDescriptionString}");
Console.WriteLine($"No assets found with {queryDescription}");
int remaining = matchingAssets.Count - checkedAssets;
if (remaining > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using CommandLine;
using Microsoft.DotNet.Darc.Operations;
using Microsoft.DotNet.DarcLib;
using System.Collections.Generic;

namespace Microsoft.DotNet.Darc.Options;

Expand All @@ -20,6 +18,9 @@ internal class GetAssetCommandLineOptions : CommandLineOptions
[Option("channel", HelpText = "Look up the asset produced from builds applied to this channel.")]
public string Channel { get; set; }

[Option("build", HelpText = "If specified, scopes the search to a specific BAR build ID")]
public int? Build { get; set; }

[Option("max-age", Default = 30, HelpText = "Show builds with a max age of this many days.")]
public int MaxAgeInDays { get; set; }

Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.DotNet.Darc/DarcLib/Actions/Remote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,10 @@ public async Task<SemanticVersion> GetToolsDotnetVersionAsync(string repoUri, st
/// <returns>Async task</returns>
public async Task AddAssetLocationToDependenciesAsync(IEnumerable<DependencyDetail> dependencies)
{
var buildCache = new Dictionary<int, Build>();

foreach (var dependency in dependencies)
{
Dictionary<int, Build> buildCache = new Dictionary<int, Build>();
IEnumerable<Asset> matchingAssets = await GetAssetsAsync(dependency.Name, dependency.Version);
List<Asset> matchingAssetsFromSameSha = new List<Asset>();

Expand Down
6 changes: 5 additions & 1 deletion src/Microsoft.DotNet.Darc/DarcLib/IRemote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ Task<DependencyFlowGraph> GetDependencyFlowGraphAsync(
/// <param name="buildId">ID of build producing the asset</param>
/// <param name="nonShipping">Only non-shipping</param>
/// <returns>List of assets.</returns>
Task<IEnumerable<Asset>> GetAssetsAsync(string name = null, string version = null, int? buildId = null, bool? nonShipping = null);
Task<IEnumerable<Asset>> GetAssetsAsync(
string name = null,
string version = null,
int? buildId = null,
bool? nonShipping = null);

/// <summary>
/// Update a list of dependencies with asset locations.
Expand Down