Skip to content

Commit

Permalink
Bump SdkVersionForWorkloadTesting to use a 200 band SDK (#63450)
Browse files Browse the repository at this point in the history
* Bump SdkVersionForWorkloadTesting to use a 200 band SDK

#62787 bumped the manifest id.  This change bumps the prop for testing.

* Download dotnet-install script for installing workloads

Instead of trying to use the script from `.dotnet`, download the script.
`.dotnet` might not exist, for example, when the `global.json` version
matches the system installed one.

* 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.

Co-authored-by: Steve Pfister <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2022
1 parent b96f560 commit a66e67b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<SdkVersionForWorkloadTesting>6.0.100-rtm.21480.21</SdkVersionForWorkloadTesting>
<SdkVersionForWorkloadTesting>6.0.200-preview.22055.18</SdkVersionForWorkloadTesting>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>6.0.0-preview-20211019.1</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
Expand Down
13 changes: 10 additions & 3 deletions src/libraries/workloads-testing.targets
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@
<MakeDir Directories="$(SdkWithNoWorkloadForTestingPath)" />

<PropertyGroup>
<_DotNetInstallScriptPath Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(DOTNET_INSTALL_DIR)/dotnet-install.sh</_DotNetInstallScriptPath>
<_DotNetInstallScriptPath Condition=" $([MSBuild]::IsOSPlatform('windows'))">$(RepoRoot).dotnet\dotnet-install.ps1</_DotNetInstallScriptPath>
</PropertyGroup>
<_DotNetInstallScriptName Condition="!$([MSBuild]::IsOSPlatform('windows'))">dotnet-install.sh</_DotNetInstallScriptName>
<_DotNetInstallScriptName Condition=" $([MSBuild]::IsOSPlatform('windows'))">dotnet-install.ps1</_DotNetInstallScriptName>

<_DotNetInstallScriptPath>$(ArtifactsObjDir)$(_DotNetInstallScriptName)</_DotNetInstallScriptPath>
</PropertyGroup>

<DownloadFile SourceUrl="https://dot.net/v1/$(_DotNetInstallScriptName)"
DestinationFolder="$(ArtifactsObjDir)"
Retries="3"
Condition="!Exists($(_DotNetInstallScriptPath))"/>

<Exec Condition="!$([MSBuild]::IsOSPlatform('windows'))"
Command="chmod +x $(_DotNetInstallScriptPath); $(_DotNetInstallScriptPath) -i $(SdkWithNoWorkloadForTestingPath) -v $(SdkVersionForWorkloadTesting)" />
Expand Down
12 changes: 10 additions & 2 deletions src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public override bool Execute()

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

// Find any existing directory with the manifest name, ignoring the case
// Multiple directories for a manifest, differing only in case causes
Expand Down Expand Up @@ -145,7 +145,15 @@ private bool InstallWorkloadManifest(string name, string version, string nugetCo
{
if (!InstallWorkloadManifest(depName, depVersion, nugetConfigContents, stopOnMissing: false))
{
Log.LogWarning($"Could not install manifest {depName}/{depVersion}. This can be ignored if the workload {WorkloadId.ItemSpec} doesn't depend on it.");
Log.LogMessage(MessageImportance.High,
$" ***** warning ******{Environment.NewLine}" +
Environment.NewLine +
$"Could not install a dependent manifest {depName}/{depVersion} for sdk band {VersionBand}.{Environment.NewLine}" +
$"If this is because this manifest doesn't have a package for sdk band {VersionBand}, " +
$"then the workload resolver will automatically fallback to the older one, and this message can be ignored.{Environment.NewLine}" +
$"This can also be safely ignored if the workload {WorkloadId.ItemSpec} doesn't use the dependency.{Environment.NewLine}" +
Environment.NewLine +
$" ********************{Environment.NewLine}");
continue;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/tasks/WorkloadBuildTasks/PackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private bool InstallActual(PackageReference[] references, bool stopOnMissing)
(int exitCode, string output) = Utils.TryRunProcess(_logger, "dotnet", args, silent: false, debugMessageImportance: MessageImportance.Low);
if (exitCode != 0)
{
LogErrorOrWarning($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing);
LogFailure($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing);
return false;
}

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

return false;
}
Expand All @@ -91,7 +91,7 @@ private bool LayoutPackages(IEnumerable<PackageReference> references, bool stopO
var source = Path.Combine(_packagesDir, pkgRef.Name.ToLower(), pkgRef.Version, pkgRef.relativeSourceDir);
if (!Directory.Exists(source))
{
LogErrorOrWarning($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing);
LogFailure($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing);
if (stopOnMissing)
return false;
}
Expand Down Expand Up @@ -152,12 +152,12 @@ private bool CopyDirectoryAfresh(string srcDir, string destDir)
}
}

private void LogErrorOrWarning(string msg, bool stopOnMissing)
private void LogFailure(string msg, bool asError)
{
if (stopOnMissing)
if (asError)
_logger.LogError(msg);
else
_logger.LogWarning(msg);
_logger.LogMessage(MessageImportance.High, $"warning: {msg}");
}
}
}

0 comments on commit a66e67b

Please sign in to comment.