Skip to content

Commit 572b9a8

Browse files
dseefelddagood
authored andcommitted
Merged PR 130846: Add archiving of packages restored during smoke-test
Add archiving of packages restored during smoke-test and include them in the tarball so they can be used by the tarball smoke-test.
1 parent cfbe095 commit 572b9a8

File tree

6 files changed

+39
-10
lines changed

6 files changed

+39
-10
lines changed

.vsts-ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ phases:
1616
queue:
1717
name: DotNet-Build
1818
demands: agent.os -equals linux
19-
timeoutInMinutes: 180
19+
timeoutInMinutes: 240
2020
parallel: 2
2121
matrix:
2222
centos71:
@@ -69,7 +69,6 @@ phases:
6969
# run smoke tests
7070
- script: $(docker.runInSourceBuild) $(imageName) ./build.sh /t:RunSmokeTest /p:Configuration=$(buildConfiguration) /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
7171
displayName: Run smoke-test
72-
condition: and(succeeded(), eq(variables['buildOfflineTarball'], false))
7372

7473
# copy smoke test logs to working directory
7574
- script: $(docker.runInSourceBuild) -v $(dropDirectory)/logs:/logs $(imageName) /bin/bash -c "mkdir -p /logs/source-build/smoke-test; find ./testing-smoke -name '*.log' -exec cp {} /logs/source-build/smoke-test \;"
@@ -94,10 +93,7 @@ phases:
9493
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
9594

9695
# run smoke tests
97-
# "-e SKIP_INIT_BUILD=true": init-build was already done by the build. Now, skip it, because the
98-
# support build.sh tries to pass all args to init-build.proj where there is no "RunSmokeTest".
99-
- script: $(docker.runInTarball) -e SKIP_INIT_BUILD=true $(imageName) ./build.sh /t:RunSmokeTest /p:Configuration=$(buildConfiguration) /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
100-
displayName: Run smoke-test
96+
- script: $(docker.runInTarball) $(imageName) ./smoke-test.sh --minimal --projectOutput --configuration $(buildConfiguration)
10197
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
10298

10399
# copy all tarball logs to working directory

build-source-tarball.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,20 @@ mkdir -p $TARBALL_ROOT/prebuilt/nuget-packages
8383
find $SCRIPT_ROOT/packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/prebuilt/nuget-packages/ \;
8484
find $SCRIPT_ROOT/bin/obj/x64/Release/nuget-packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/prebuilt/nuget-packages/ \;
8585

86+
if [ -e $SCRIPT_ROOT/testing-smoke/smoke-test-packages ]; then
87+
cp -rf $SCRIPT_ROOT/testing-smoke/smoke-test-packages $TARBALL_ROOT/prebuilt
88+
fi
89+
8690
echo 'Removing source-built packages from tarball prebuilts...'
8791

8892
for built_package in $(find $SCRIPT_ROOT/bin/obj/x64/Release/blob-feed/packages/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]')
8993
do
9094
if [ -e $TARBALL_ROOT/prebuilt/nuget-packages/$(basename $built_package) ]; then
9195
rm $TARBALL_ROOT/prebuilt/nuget-packages/$(basename $built_package)
9296
fi
97+
if [ -e $TARBALL_ROOT/prebuilt/smoke-test-packages/$(basename $built_package) ]; then
98+
rm $TARBALL_ROOT/prebuilt/smoke-test-packages/$(basename $built_package)
99+
fi
93100
done
94101

95102
if [ -z "${SOURCE_BUILD_SKIP_PREBUILT_REPORT:-}" ]; then

build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
translated into '/' if it's passed in the Command arg.
5454
This is also a problem when passing CLI feeds: https://github.com/dotnet/source-build/issues/561
5555
-->
56-
<Exec Command="./smoke-test.sh --minimal --projectOutput --configuration $(Configuration)"
56+
<Exec Command="./smoke-test.sh --minimal --projectOutput --configuration $(Configuration) --archiveRestoredPackages"
5757
EnvironmentVariables="prodConBlobFeedUrl=$(ProdConBlobFeedUrl)" />
5858
</Target>
5959

smoke-test.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ logFile="$testingDir/smoke-test.log"
2323
restoredPackagesDir="$testingDir/packages"
2424
testingHome="$testingDir/home"
2525
prodConBlobFeedUrl=${prodConBlobFeedUrl-}
26+
archiveRestoredPackages=false
27+
archivedPackagesDir="$testingDir/smoke-test-packages"
28+
smokeTestPrebuilts="$SCRIPT_ROOT/prebuilt/smoke-test-packages"
2629

2730
function usage() {
2831
echo ""
@@ -40,6 +43,7 @@ function usage() {
4043
echo " --excludeOnlineTests exclude test that use online sources for nuget packages"
4144
echo " --devCertsVersion <version> use dotnet-dev-certs <version> instead of default $DEV_CERTS_VERSION_DEFAULT"
4245
echo " --prodConBlobFeedUrl <url> override the prodcon blob feed specified in ProdConFeed.txt"
46+
echo " --archiveRestoredPackages capture all restored packages to $archivedPackagesDir"
4347
echo "environment:"
4448
echo " prodConBlobFeedUrl override the prodcon blob feed specified in ProdConFeed.txt"
4549
echo ""
@@ -99,6 +103,9 @@ while :; do
99103
shift
100104
prodConBlobFeedUrl="$1"
101105
;;
106+
--archiverestoredpackages)
107+
archiveRestoredPackages=true
108+
;;
102109
*)
103110
usage
104111
exit 1
@@ -263,6 +270,22 @@ function setupProdConFeed() {
263270
sed -i.bakProdCon "s|PRODUCT_CONTRUCTION_PACKAGES|$prodConBlobFeedUrl|g" "$testingDir/NuGet.Config"
264271
}
265272

273+
function setupSmokeTestFeed() {
274+
# Setup smoke-test-packages if they exist
275+
if [ -e "$smokeTestPrebuilts" ]; then
276+
sed -i.bakSmokeTestFeed "s|SMOKE_TEST_PACKAGE_FEED|$smokeTestPrebuilts|g" "$testingDir/NuGet.Config"
277+
else
278+
sed -i.bakSmokeTestFeed "/SMOKE_TEST_PACKAGE_FEED/d" "$testingDir/NuGet.Config"
279+
fi
280+
}
281+
282+
function copyRestoredPackages() {
283+
if [ "$archiveRestoredPackages" == "true" ]; then
284+
mkdir -p "$archivedPackagesDir"
285+
cp -rf "$restoredPackagesDir"/* "$archivedPackagesDir"
286+
fi
287+
}
288+
266289
# Clean up and create directory
267290
if [ -e "$testingDir" ]; then
268291
read -p "testing-smoke directory exists, remove it? [Y]es / [n]o" -n 1 -r
@@ -302,11 +325,13 @@ if [ "$excludeLocalTests" == "false" ]; then
302325
cp "$SCRIPT_ROOT/smoke-testNuGet.Config" "$testingDir/NuGet.Config"
303326
sed -i.bak "s|SOURCE_BUILT_PACKAGES|$SOURCE_BUILT_PKGS_PATH|g" "$testingDir/NuGet.Config"
304327
setupProdConFeed
328+
setupSmokeTestFeed
305329
echo "$testingDir/NuGet.Config Contents:"
306330
cat "$testingDir/NuGet.Config"
307331
fi
308332
echo "RUN ALL TESTS - LOCAL RESTORE SOURCE"
309333
runAllTests
334+
copyRestoredPackages
310335
echo "LOCAL RESTORE SOURCE - ALL TESTS PASSED!"
311336
fi
312337

@@ -317,11 +342,13 @@ if [ "$excludeOnlineTests" == "false" ]; then
317342
cp "$SCRIPT_ROOT/smoke-testNuGet.Config" "$testingDir/NuGet.Config"
318343
sed -i.bak "/SOURCE_BUILT_PACKAGES/d" "$testingDir/NuGet.Config"
319344
setupProdConFeed
345+
setupSmokeTestFeed
320346
echo "$testingDir/NuGet.Config Contents:"
321347
cat "$testingDir/NuGet.Config"
322348
fi
323349
echo "RUN ALL TESTS - ONLINE RESTORE SOURCE"
324350
runAllTests
351+
copyRestoredPackages
325352
echo "ONLINE RESTORE SOURCE - ALL TESTS PASSED!"
326353
fi
327354

smoke-testNuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
88
<add key="dotnet.myget.org/feed/dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
99
<add key="ProdCon" value="PRODUCT_CONTRUCTION_PACKAGES" />
10+
<add key="smoke-test feed" value="SMOKE_TEST_PACKAGE_FEED" />
1011
</packageSources>
1112
</configuration>

support/tarball/build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@ PREBUILT_PACKAGE_SOURCE="$SCRIPT_ROOT/prebuilt/nuget-packages"
3434
exit 1
3535
)
3636

37-
if [ -z "${SKIP_INIT_BUILD:-}" ]; then
38-
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$CLI_VERSION/MSBuild.dll $SCRIPT_ROOT/tools-local/init-build.proj /t:WriteDynamicPropsToStaticPropsFiles /p:GeneratingStaticPropertiesFile=true ${MSBUILD_ARGUMENTS[@]} "$@"
39-
fi
37+
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$CLI_VERSION/MSBuild.dll $SCRIPT_ROOT/tools-local/init-build.proj /t:WriteDynamicPropsToStaticPropsFiles /p:GeneratingStaticPropertiesFile=true ${MSBUILD_ARGUMENTS[@]} "$@"
4038
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$CLI_VERSION/MSBuild.dll $SCRIPT_ROOT/build.proj ${MSBUILD_ARGUMENTS[@]} "$@"

0 commit comments

Comments
 (0)