Skip to content

Commit f8aaeec

Browse files
committed
Workloads: fix CI build when bumping to a newer version band
To resolve a workload, the current version band is used to look in `sdk-manifests` directory. But when in development, and bumping to a newer version band, not all the manifests might have packages for that. This shows up when bumping the band to `6.0.200`, where we generate the corresponding packages for wasm-tools. But the Emscripten packages are still on `6.0.100`. SDK [added](dotnet/sdk#19545) support for falling back to older bands in that case. The `InstallWorkloadFromArtifacts` task emits a warning about not being able to find the emscripten manifest package. But this becomes an error on CI due to warnaserror=true. So, log a message instead of a warning. But this is only done for the *dependent* manifest.
1 parent 814f163 commit f8aaeec

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public override bool Execute()
9292

9393
private bool InstallWorkloadManifest(string name, string version, string nugetConfigContents, bool stopOnMissing)
9494
{
95-
Log.LogMessage(MessageImportance.High, $"Installing workload manifest for {name}/{version}");
95+
Log.LogMessage(MessageImportance.High, $"Installing workload manifest for {name}/{version} for sdk band {VersionBand}");
9696

9797
// Find any existing directory with the manifest name, ignoring the case
9898
// Multiple directories for a manifest, differing only in case causes
@@ -145,7 +145,15 @@ private bool InstallWorkloadManifest(string name, string version, string nugetCo
145145
{
146146
if (!InstallWorkloadManifest(depName, depVersion, nugetConfigContents, stopOnMissing: false))
147147
{
148-
Log.LogWarning($"Could not install manifest {depName}/{depVersion}. This can be ignored if the workload {WorkloadId.ItemSpec} doesn't depend on it.");
148+
Log.LogMessage(MessageImportance.High,
149+
$" ***** warning ******{Environment.NewLine}" +
150+
Environment.NewLine +
151+
$"Could not install a dependent manifest {depName}/{depVersion} for sdk band {VersionBand}.{Environment.NewLine}" +
152+
$"If this is because this manifest doesn't have a package for sdk band {VersionBand}, " +
153+
$"then the workload resolver will automatically fallback to the older one, and this message can be ignored.{Environment.NewLine}" +
154+
$"This can also be safely ignored if the workload {WorkloadId.ItemSpec} doesn't use the dependency.{Environment.NewLine}" +
155+
Environment.NewLine +
156+
$" ********************{Environment.NewLine}");
149157
continue;
150158
}
151159
}

src/tasks/WorkloadBuildTasks/PackageInstaller.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private bool InstallActual(PackageReference[] references, bool stopOnMissing)
6363
(int exitCode, string output) = Utils.TryRunProcess(_logger, "dotnet", args, silent: false, debugMessageImportance: MessageImportance.Low);
6464
if (exitCode != 0)
6565
{
66-
LogErrorOrWarning($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing);
66+
LogFailure($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing);
6767
return false;
6868
}
6969

@@ -76,7 +76,7 @@ private bool InstallActual(PackageReference[] references, bool stopOnMissing)
7676
{
7777
_logger.LogMessage(MessageImportance.Normal, output);
7878
foreach ((PackageReference pkgRef, string pkgDir) in failedToRestore)
79-
LogErrorOrWarning($"Could not restore {pkgRef.Name}/{pkgRef.Version} (can't find {pkgDir})", stopOnMissing);
79+
LogFailure($"Could not restore {pkgRef.Name}/{pkgRef.Version} (can't find {pkgDir})", stopOnMissing);
8080

8181
return false;
8282
}
@@ -91,7 +91,7 @@ private bool LayoutPackages(IEnumerable<PackageReference> references, bool stopO
9191
var source = Path.Combine(_packagesDir, pkgRef.Name.ToLower(), pkgRef.Version, pkgRef.relativeSourceDir);
9292
if (!Directory.Exists(source))
9393
{
94-
LogErrorOrWarning($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing);
94+
LogFailure($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing);
9595
if (stopOnMissing)
9696
return false;
9797
}
@@ -152,12 +152,12 @@ private bool CopyDirectoryAfresh(string srcDir, string destDir)
152152
}
153153
}
154154

155-
private void LogErrorOrWarning(string msg, bool stopOnMissing)
155+
private void LogFailure(string msg, bool asError)
156156
{
157-
if (stopOnMissing)
157+
if (asError)
158158
_logger.LogError(msg);
159159
else
160-
_logger.LogWarning(msg);
160+
_logger.LogMessage(MessageImportance.High, $"warning: {msg}");
161161
}
162162
}
163163
}

0 commit comments

Comments
 (0)