Merge pull request #14716 from dotnet-maestro-bot/merge/release/6.0.1xx-to-release/6.0.3xx

[automated] Merge branch 'release/6.0.1xx' => 'release/6.0.3xx'
This commit is contained in:
Marc Paine 2022-10-11 13:00:09 -07:00 committed by GitHub
commit 2d21c668bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 10 deletions

View file

@ -107,6 +107,7 @@
SMOKE_TESTS_SDK_TARBALL_PATH=$(SdkTarballPath);
SMOKE_TESTS_TARGET_RID=$(TargetRid);
SMOKE_TESTS_PORTABLE_RID=$(PortableRid);
SMOKE_TESTS_CUSTOM_PACKAGES_PATH=$(CustomSourceBuiltPackagesPath);
$(CustomTestEnvVars)" />
</Target>

View file

@ -19,8 +19,9 @@ SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
MSBUILD_ARGUMENTS=("/flp:v=detailed")
CUSTOM_REF_PACKAGES_DIR=''
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR=''
CUSTOM_PACKAGES_DIR=''
alternateTarget=false
runningSmokeTests=false
CUSTOM_SDK_DIR=''
while :; do
@ -41,15 +42,15 @@ while :; do
;;
--run-smoke-test)
alternateTarget=true
runningSmokeTests=true
MSBUILD_ARGUMENTS+=( "/t:RunSmokeTest" )
;;
--with-packages)
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR="$(cd -P "$2" && pwd)"
if [ ! -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then
echo "Custom prviously built packages directory '$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR' does not exist"
CUSTOM_PACKAGES_DIR="$(cd -P "$2" && pwd)"
if [ ! -d "$CUSTOM_PACKAGES_DIR" ]; then
echo "Custom prviously built packages directory '$CUSTOM_PACKAGES_DIR' does not exist"
exit 1
fi
MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" )
shift
;;
--with-sdk)
@ -82,13 +83,21 @@ while :; do
shift
done
if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then
if [ "$runningSmokeTests" == "true" ]; then
MSBUILD_ARGUMENTS+=( "/p:CustomSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
else
MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
fi
fi
if [ -f "$SCRIPT_ROOT/packages/archive/archiveArtifacts.txt" ]; then
ARCHIVE_ERROR=0
if [ ! -d "$SCRIPT_ROOT/.dotnet" ] && [ "$CUSTOM_SDK_DIR" == "" ]; then
echo "ERROR: SDK not found at $SCRIPT_ROOT/.dotnet"
ARCHIVE_ERROR=1
fi
if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" == "" ]; then
if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PACKAGES_DIR" == "" ]; then
echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at $SCRIPT_ROOT/packages/archive/ - Either run prep.sh or pass --with-packages parameter"
ARCHIVE_ERROR=1
fi
@ -120,7 +129,9 @@ fi
packageVersionsPath=''
restoredPackagesDir="$SCRIPT_ROOT/packages/restored"
if [ -d "$SCRIPT_ROOT/packages/archive" ]; then
if [[ "$CUSTOM_PACKAGES_DIR" != "" && -f "$CUSTOM_PACKAGES_DIR/PackageVersions.props" ]]; then
packageVersionsPath="$CUSTOM_PACKAGES_DIR/PackageVersions.props"
elif [ -d "$SCRIPT_ROOT/packages/archive" ]; then
sourceBuiltArchive=`find $SCRIPT_ROOT/packages/archive -maxdepth 1 -name 'Private.SourceBuilt.Artifacts*.tar.gz'`
if [ -f "$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props" ]; then
packageVersionsPath=$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props
@ -128,14 +139,12 @@ if [ -d "$SCRIPT_ROOT/packages/archive" ]; then
tar -xzf "$sourceBuiltArchive" -C /tmp PackageVersions.props
packageVersionsPath=/tmp/PackageVersions.props
fi
elif [ -f "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" ]; then
packageVersionsPath="$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
fi
if [ ! -f "$packageVersionsPath" ]; then
echo "Cannot find PackagesVersions.props. Debugging info:"
echo " Attempted archive path: $SCRIPT_ROOT/packages/archive"
echo " Attempted custom PVP path: $CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
echo " Attempted custom PVP path: $CUSTOM_PACKAGES_DIR/PackageVersions.props"
exit 1
fi

View file

@ -15,6 +15,7 @@ internal static class Config
public const string PoisonReportPathEnv = "SMOKE_TESTS_POISON_REPORT_PATH";
public const string PortableRidEnv = "SMOKE_TESTS_PORTABLE_RID";
public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH";
public const string CustomPackagesPathEnv = "SMOKE_TESTS_CUSTOM_PACKAGES_PATH";
public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH";
public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID";
public const string WarnPoisonDiffsEnv = "SMOKE_TESTS_WARN_POISON_DIFFS";
@ -27,6 +28,7 @@ internal static class Config
public static string PortableRid { get; } = Environment.GetEnvironmentVariable(PortableRidEnv) ??
throw new InvalidOperationException($"'{Config.PortableRidEnv}' must be specified");
public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv);
public static string? CustomPackagesPath { get; } = Environment.GetEnvironmentVariable(CustomPackagesPathEnv);
public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv);
public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ??
throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified");

View file

@ -5,6 +5,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
@ -66,6 +67,8 @@ internal class DotNetHelper
if (useLocalPackages)
{
// When using local packages this feed is always required. It contains packages that are
// not produced by source-build but are required by the various project templates.
if (!Directory.Exists(Config.PrereqsPath))
{
throw new InvalidOperationException(
@ -74,6 +77,21 @@ internal class DotNetHelper
string nugetConfig = File.ReadAllText(nugetConfigPath);
nugetConfig = nugetConfig.Replace("SMOKE_TEST_PACKAGE_FEED", Config.PrereqsPath);
// This package feed is optional. You can use an additional feed of source-built packages to run the
// smoke-tests as offline as possible.
if (Config.CustomPackagesPath != null)
{
if (!Directory.Exists(Config.CustomPackagesPath))
{
throw new ArgumentException($"Specified --with-packages {Config.CustomPackagesPath} does not exist.");
}
nugetConfig = nugetConfig.Replace("CUSTOM_PACKAGE_FEED", Config.CustomPackagesPath);
}
else
{
nugetConfig = string.Join(Environment.NewLine, nugetConfig.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(s => !s.Contains("CUSTOM_PACKAGE_FEED")).ToArray());
}
File.WriteAllText(nugetConfigPath, nugetConfig);
}
}

View file

@ -3,5 +3,6 @@
<packageSources>
<clear />
<add key="smoke-test-prereqs" value="SMOKE_TEST_PACKAGE_FEED" />
<add key="custom-packages" value="CUSTOM_PACKAGE_FEED" />
</packageSources>
</configuration>