2023-03-01 17:19:54 +00:00
parameters :
- name : buildName
type : string
- name : targetRid
type : string
- name : architecture
type : string
2023-03-03 11:17:00 +00:00
- name : dotnetDotnetRunId
2023-03-02 12:11:58 +00:00
type : string
2023-09-07 22:17:59 +00:00
- name : includeArtifactsSize
2023-08-31 21:15:01 +00:00
type : boolean
2023-09-07 22:17:59 +00:00
default : false
2023-08-31 21:15:01 +00:00
2023-03-01 17:19:54 +00:00
jobs :
- job : ${{ parameters.buildName }}_${{ parameters.architecture }}
timeoutInMinutes : 150
pool :
name : NetCore1ESPool-Svc-Internal
demands : ImageOverride -equals 1es-ubuntu-2004
variables :
2023-03-03 10:42:45 +00:00
- template : ../variables/pipelines.yml
2023-03-01 17:19:54 +00:00
steps :
2023-03-02 12:09:30 +00:00
- script : |
2023-03-03 12:21:52 +00:00
dotnet_dotnet_build='${{ replace(parameters.dotnetDotnetRunId, ' ', '') }}'
2023-03-02 12:09:30 +00:00
2023-03-03 12:21:52 +00:00
if [[ -z "$dotnet_dotnet_build" ]]; then
2023-03-06 11:59:00 +00:00
dotnet_dotnet_build=$(az pipelines runs list --branch '$(Build.SourceBranch)' --organization '$(AZDO_ORG)' --project '$(AZDO_PROJECT)' --pipeline-ids '$(DOTNET_DOTNET_CI_PIPELINE_ID)' --status completed --top 1 --query "[].id" --output tsv)
2023-03-02 12:09:30 +00:00
fi
2023-03-03 12:21:52 +00:00
if [[ -z "$dotnet_dotnet_build" ]]; then
2023-03-06 16:35:50 +00:00
echo "Could not find a completed dotnet-dotnet build for branch '$(Build.SourceBranch)'"
2023-03-02 12:09:30 +00:00
exit 1
fi
2023-03-06 11:59:00 +00:00
echo "Dotnet-dotnet build: https://dev.azure.com/dnceng/internal/_build/results?buildId=$dotnet_dotnet_build&view=results"
2023-03-02 12:09:30 +00:00
2023-03-03 12:21:52 +00:00
installer_sha=$(az pipelines build tag list --organization '$(AZDO_ORG)' --project '$(AZDO_PROJECT)' --build-id $dotnet_dotnet_build --output tsv | sed "s,installer-,,g")
2023-03-02 12:09:30 +00:00
installer_build=$(az pipelines runs list --organization '$(AZDO_ORG)' --project '$(AZDO_PROJECT)' --pipeline-ids '$(INSTALLER_OFFICIAL_CI_PIPELINE_ID)' --query "[?sourceVersion == '$installer_sha'].id" --output tsv)
if [[ -z "$installer_build" ]]; then
2023-03-06 16:35:50 +00:00
echo "Could not find a build of installer for commit '$installer_sha'"
2023-03-02 12:09:30 +00:00
exit 1
fi
2023-03-03 12:12:25 +00:00
echo "Installer build: https://dev.azure.com/dnceng/internal/_build/results?buildId=$installer_build&view=results"
2023-03-06 12:02:48 +00:00
echo "##vso[build.addbuildtag]installer-$installer_sha"
2023-03-02 12:09:30 +00:00
echo "##vso[task.setvariable variable=InstallerBuildId]$installer_build"
2023-03-03 13:28:30 +00:00
echo "##vso[task.setvariable variable=DotnetDotnetBuildId]$dotnet_dotnet_build"
2023-03-03 10:47:05 +00:00
displayName : Find associated builds
2023-03-02 12:09:30 +00:00
name : Get_Build_Ids
env :
AZURE_DEVOPS_EXT_PAT : $(System.AccessToken)
2023-08-22 21:43:26 +00:00
- template : ../steps/download-pipeline-artifact.yml
parameters :
2023-12-11 06:41:45 +00:00
patterns : '**/dotnet-sdk-+([0-9]).+([0-9]).+([0-9])?(-@(alpha|preview|rc|rtm)*)-linux*-${{ parameters.architecture }}.tar.gz'
2023-08-22 21:43:26 +00:00
displayName : Download MSFT SDK
2023-03-01 17:19:54 +00:00
2023-08-22 21:43:26 +00:00
- template : ../steps/download-vmr-artifact.yml
parameters :
buildName : ${{ parameters.buildName }}
architecture : ${{ parameters.architecture }}
2023-03-01 17:19:54 +00:00
patterns : '**/dotnet-sdk-+([0-9]).+([0-9]).+([0-9])?(-@(alpha|preview|rc|rtm)*)-${{ parameters.targetRid }}.tar.gz'
2023-08-22 21:43:26 +00:00
displayName : Download Source Build SDK
2023-08-21 21:33:56 +00:00
2023-08-22 21:43:26 +00:00
- template : ../steps/download-vmr-artifact.yml
parameters :
buildName : ${{ parameters.buildName }}
architecture : ${{ parameters.architecture }}
2023-08-21 21:33:56 +00:00
patterns : '**/Private.SourceBuilt.Artifacts.+([0-9]).+([0-9]).+([0-9])?(-@(alpha|preview|rc|rtm)*).${{ parameters.targetRid }}.tar.gz'
2023-08-22 21:43:26 +00:00
displayName : Download Source Built Artifacts
2023-03-01 17:19:54 +00:00
- script : |
2023-11-17 23:38:44 +00:00
platform="linux"
if [[ ${{ parameters.targetRid }} =~ "alpine" ]]; then
platform="$platform-musl"
fi
msft_sdk_tarball_name=$(find "$(Pipeline.Workspace)/Artifacts" -name "dotnet-sdk-*-$platform-${{ parameters.architecture }}.tar.gz" -exec basename {} \;)
2023-03-01 17:19:54 +00:00
2023-03-06 14:32:17 +00:00
if [[ -z "$msft_sdk_tarball_name" ]]; then
2023-03-28 14:42:58 +00:00
echo "Microsoft SDK tarball does not exist in '$(Pipeline.Workspace)/Artifacts'. The associated build https://dev.azure.com/dnceng/internal/_build/results?buildId=$(InstallerBuildId) might have failed."
2023-03-01 17:19:54 +00:00
exit 1
fi
2023-03-03 11:06:01 +00:00
sdk_tarball_name=$(find "$(Pipeline.Workspace)/Artifacts" -name "dotnet-sdk-*-${{ parameters.targetRid }}.tar.gz" -exec basename {} \;)
2023-03-01 17:19:54 +00:00
2023-03-06 14:34:18 +00:00
if [[ -z "$sdk_tarball_name" ]]; then
2023-03-28 14:42:58 +00:00
echo "Source-build SDK tarball does not exist in '$(Pipeline.Workspace)/Artifacts'. The associated build https://dev.azure.com/dnceng/internal/_build/results?buildId=$(DotnetDotnetBuildId) might have failed"
2023-03-01 17:19:54 +00:00
exit 1
fi
2023-08-21 21:33:56 +00:00
artifacts_path=$(find "$(Pipeline.Workspace)/Artifacts" -name "Private.SourceBuilt.Artifacts.*.${{ parameters.targetRid }}.tar.gz" -exec basename {} \;)
if [[ -z "$artifacts_path" ]]; then
echo "Source-build artifacts path does not exist in '$(Pipeline.Workspace)/Artifacts'. The associated build https://dev.azure.com/dnceng/internal/_build/results?buildId=$(DotnetDotnetBuildId) might have failed"
exit 1
fi
2023-03-09 10:31:05 +00:00
eng/common/build.sh -bl --projects $(Build.SourcesDirectory)/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj --restore
2023-03-01 17:19:54 +00:00
2023-11-17 23:38:44 +00:00
echo "##vso[task.setvariable variable=Platform]$platform"
2023-03-06 14:48:34 +00:00
echo "##vso[task.setvariable variable=MsftSdkTarballPath]$(Pipeline.Workspace)/Artifacts/$msft_sdk_tarball_name"
echo "##vso[task.setvariable variable=SdkTarballPath]$(Pipeline.Workspace)/Artifacts/$sdk_tarball_name"
2023-08-21 21:33:56 +00:00
echo "##vso[task.setvariable variable=SourceBuiltArtifactsPath]$(Pipeline.Workspace)/Artifacts/$artifacts_path"
2023-03-06 09:45:22 +00:00
displayName : Prepare Tests
workingDirectory : $(Build.SourcesDirectory)
- script : >
2023-03-06 14:31:54 +00:00
.dotnet/dotnet test
2023-03-06 09:45:22 +00:00
$(Build.SourcesDirectory)/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj
2023-07-28 14:48:27 +00:00
--filter "Category=SdkContent"
2023-03-06 09:45:22 +00:00
--logger:'trx;LogFileName=$(Agent.JobName)_SDKDiffTests.trx'
--logger:'console;verbosity=detailed'
2023-03-09 10:31:05 +00:00
-c Release
-bl:$(Build.SourcesDirectory)/artifacts/log/Debug/BuildTests_$(date +"%m%d%H%M%S").binlog
-flp:LogFile=$(Build.SourcesDirectory)/artifacts/logs/BuildTests_$(date +"%m%d%H%M%S").log
-clp:v=m
2023-03-06 14:48:34 +00:00
-e SMOKE_TESTS_MSFT_SDK_TARBALL_PATH=$(MsftSdkTarballPath)
-e SMOKE_TESTS_SDK_TARBALL_PATH=$(SdkTarballPath)
2023-08-18 18:40:05 +00:00
-e SMOKE_TESTS_SOURCEBUILT_ARTIFACTS_PATH=$(SourceBuiltArtifactsPath)
2023-03-06 09:45:22 +00:00
-e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=false
-e SMOKE_TESTS_RUNNING_IN_CI=true
-e SMOKE_TESTS_TARGET_RID=${{ parameters.targetRid }}
2023-11-17 23:38:44 +00:00
-e SMOKE_TESTS_PORTABLE_RID=$(Platform)-${{ parameters.architecture }}
2023-08-31 21:15:01 +00:00
-e SMOKE_TESTS_CUSTOM_PACKAGES_PATH=
2023-09-07 22:17:59 +00:00
-e SMOKE_TESTS_INCLUDE_ARTIFACTSSIZE=${{ parameters.includeArtifactsSize }}
2023-03-01 17:19:54 +00:00
displayName : Run Tests
workingDirectory : $(Build.SourcesDirectory)
2023-03-09 10:31:05 +00:00
- script : |
set -x
targetFolder=$(Build.StagingDirectory)/BuildLogs/
mkdir -p ${targetFolder}
cd "$(Build.SourcesDirectory)"
find artifacts/ -type f -name "BuildTests*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/ -type f -name "BuildTests*.log" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/ -type f -name "Build.binlog" -exec cp {} --parents -t ${targetFolder} \;
cd "$(Build.SourcesDirectory)/src/SourceBuild/content"
find test/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "Updated*.diff" -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "Updated*.txt" -exec cp {} --parents -t ${targetFolder} \;
displayName : Prepare BuildLogs staging directory
continueOnError : true
condition : succeededOrFailed()
- publish : '$(Build.StagingDirectory)/BuildLogs'
artifact : $(Agent.JobName)_BuildLogs_Attempt$(System.JobAttempt)
displayName : Publish BuildLogs
continueOnError : true
condition : succeededOrFailed()
2023-03-01 17:19:54 +00:00
- task : PublishTestResults@2
displayName : Publish Test Results
condition : succeededOrFailed()
continueOnError : true
inputs :
testRunner : vSTest
testResultsFiles : '*.trx'
searchFolder : $(Build.SourcesDirectory)/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/TestResults
mergeTestResults : true
publishRunAttachments : true
2023-03-06 14:34:50 +00:00
testRunTitle : $(Agent.JobName)