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

Fix warnings on Helix EOL queues #8426

Merged
merged 1 commit into from
Feb 3, 2022
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
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ stages:
-ci
-restore
-test
-warnAsError $false
-projects $(Build.SourcesDirectory)\tests\UnitTests.proj
/bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\Helix.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down Expand Up @@ -170,6 +171,7 @@ stages:
-ci
-restore
-test
-warnAsError $false
-projects $(Build.SourcesDirectory)\tests\XHarness.Android.DeviceTests.proj
/bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\Helix.XHarness.Android.Device.Tests.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down Expand Up @@ -200,6 +202,7 @@ stages:
--ci
--restore
--test
--warnAsError false
--projects $(Build.SourcesDirectory)/tests/UnitTests.proj
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down Expand Up @@ -230,6 +233,7 @@ stages:
-ci
-restore
-test
-warnAsError false
-projects $(Build.SourcesDirectory)/tests/XHarness.Apple.SimulatorTests.proj
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/XHarness.Apple.Simulator.Tests.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down Expand Up @@ -260,6 +264,7 @@ stages:
-ci
-restore
-test
-warnAsError false
-projects $(Build.SourcesDirectory)/tests/XHarness.Apple.DeviceTests.proj
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.XHarness.Apple.Device.Tests.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down Expand Up @@ -290,6 +295,7 @@ stages:
-ci
-restore
-test
-warnAsError false
-projects $(Build.SourcesDirectory)/tests/XHarness.Android.SimulatorTests.proj
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.XHarness.Android.Simulator.Tests.binlog
/p:RestoreUsingNuGetTargets=false
Expand Down
12 changes: 2 additions & 10 deletions src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,31 +238,23 @@ public async Task<ISentJob> SendAsync(Action<string> log, CancellationToken canc

private void WarnForImpendingRemoval(Action<string> log, QueueInfo queueInfo)
{
bool azDoVariableDefined = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SYSTEM_TEAMPROJECT"));
DateTime whenItExpires = DateTime.MaxValue;

if (DateTime.TryParseExact(queueInfo.EstimatedRemovalDate, "yyyy-MM-dd", null, DateTimeStyles.AssumeUniversal, out DateTime dtIso))
{
whenItExpires = dtIso;
}
// This branch can be removed once the strings start coming in in ISO-8601 format
// Currently the API provides values in this format though and they are unlikely to get confused with each other.
else if (DateTime.TryParseExact(queueInfo.EstimatedRemovalDate, "M/d/yyyy", null, DateTimeStyles.AssumeUniversal, out DateTime dtUsa))
{
whenItExpires = dtUsa;
}

if (whenItExpires != DateTime.MaxValue) // We recognized a date from the string
{
TimeSpan untilRemoved = whenItExpires.ToUniversalTime().Subtract(DateTime.UtcNow);
if (untilRemoved.TotalDays <= 21)
{
log?.Invoke($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Helix queue {queueInfo.QueueId} {(untilRemoved.TotalDays < 0 ? "was" : "is")} slated for removal on {queueInfo.EstimatedRemovalDate}. Please discontinue usage. Contact dnceng for questions / concerns ");
log?.Invoke($"warning : Helix queue {queueInfo.QueueId} {(untilRemoved.TotalDays < 0 ? "was" : "is")} slated for removal on {queueInfo.EstimatedRemovalDate}. Please discontinue usage. Contact dnceng for questions / concerns ");
}
}
else
{
log?.Invoke($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Unable to parse estimated removal date '{queueInfo.EstimatedRemovalDate}' for queue '{queueInfo.QueueId}' (please contact dnceng with this information)");
log?.Invoke($"error : Unable to parse estimated removal date '{queueInfo.EstimatedRemovalDate}' for queue '{queueInfo.QueueId}' (please contact dnceng with this information)");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.DotNet.Helix/Sdk/SendHelixJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ protected override async Task ExecuteCore(CancellationToken cancellationToken)
}

Log.LogMessage(MessageImportance.High, $"Sending Job to {TargetQueue}...");

cancellationToken.ThrowIfCancellationRequested();
ISentJob job = await def.SendAsync(msg => Log.LogMessage(msg), cancellationToken);
// LogMessageFromText will take any string formatted as a canonical error or warning and convert the type of log to this
ISentJob job = await def.SendAsync(msg => Log.LogMessageFromText(msg, MessageImportance.High), cancellationToken);
JobCorrelationId = job.CorrelationId;
JobCancellationToken = job.HelixCancellationToken;
ResultsContainerUri = job.ResultsContainerUri;
Expand Down