Skip to content

Commit 37edb88

Browse files
authored
Basic smoke tests for .NET chiseled containers (#4805)
* Run installer smoke tests on chiseled containers * TEMP test without pre-build * Try fix build * Fix chiseled container build * Try fix dd-dotnet in chiseled containers * Add arm64 checks too * Try to solve the logs issue * Try something else * Removed smoke-test log checks (as we can't generate logs) * Fix hardcoded version * OK, give up on that * Minor cleanup * Go back to sourcing artifacts correctly * Fix typo * Tweak targets to be more future proof * Revert "Go back to sourcing artifacts correctly" This reverts commit 4ae7f8f. * This is getting tiresome * Revert "Revert "Go back to sourcing artifacts correctly"" This reverts commit 25f8915.
1 parent f1cf405 commit 37edb88

File tree

4 files changed

+356
-9
lines changed

4 files changed

+356
-9
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4761,6 +4761,85 @@ stages:
47614761
command: "CheckSmokeTestsForErrors"
47624762
apikey: $(DD_LOGGER_DD_API_KEY)
47634763

4764+
- stage: installer_chiseled_smoke_tests
4765+
condition: and(succeeded(), eq(variables['isBenchmarksOnlyBuild'], 'False'))
4766+
dependsOn: [package_linux, generate_variables, merge_commit_id]
4767+
variables:
4768+
targetShaId: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.sha']]
4769+
targetBranch: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.branch']]
4770+
jobs:
4771+
- template: steps/update-github-status-jobs.yml
4772+
parameters:
4773+
jobs: [linux]
4774+
4775+
- job: linux
4776+
timeoutInMinutes: 45 # should take ~5 mins
4777+
strategy:
4778+
matrix: $[ stageDependencies.generate_variables.generate_variables_job.outputs['generate_variables_step.installer_chiseled_smoke_tests_matrix'] ]
4779+
variables:
4780+
smokeTestAppDir: "$(System.DefaultWorkingDirectory)/tracer/test/test-applications/regression/AspNetCoreSmokeTest"
4781+
pool:
4782+
vmImage: ubuntu-20.04
4783+
4784+
steps:
4785+
- template: steps/clone-repo.yml
4786+
parameters:
4787+
targetShaId: $(targetShaId)
4788+
targetBranch: $(targetBranch)
4789+
4790+
- task: DownloadPipelineArtifact@2
4791+
displayName: Download artifacts to smoke test directory
4792+
inputs:
4793+
artifact: $(linuxArtifacts)
4794+
path: $(smokeTestAppDir)/artifacts
4795+
4796+
- script: |
4797+
mkdir -p tracer/build_data/snapshots
4798+
mkdir -p tracer/build_data/logs
4799+
displayName: create test data directories
4800+
4801+
# Run the "normal" installer smoke tests
4802+
- script: |
4803+
docker-compose -p ddtrace_$(Build.BuildNumber) build \
4804+
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
4805+
--build-arg RUNTIME_IMAGE=$(runtimeImage) \
4806+
--build-arg PUBLISH_FRAMEWORK=$(publishFramework) \
4807+
chiseled-smoke-tests
4808+
env:
4809+
dockerTag: $(dockerTag)
4810+
DD_LOGGER_DD_API_KEY: $(ddApiKey)
4811+
displayName: docker-compose build chiseled-smoke-tests
4812+
retryCountOnTaskFailure: 3
4813+
4814+
- template: steps/run-snapshot-test.yml
4815+
parameters:
4816+
target: 'chiseled-smoke-tests'
4817+
snapshotPrefix: "smoke_test"
4818+
4819+
# Run the "dd-dotnet" installer smoke tests
4820+
- script: |
4821+
docker-compose -p ddtrace_$(Build.BuildNumber) build \
4822+
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
4823+
--build-arg RUNTIME_IMAGE=$(runtimeImage) \
4824+
--build-arg PUBLISH_FRAMEWORK=$(publishFramework) \
4825+
--build-arg RUNTIME_ID="$(runtimeId)" \
4826+
dd-dotnet-chiseled-smoke-tests
4827+
env:
4828+
dockerTag: $(dockerTag)
4829+
dockerTarget: $(runtimeId)
4830+
displayName: docker-compose build dd-dotnet-chiseled-smoke-tests
4831+
retryCountOnTaskFailure: 3
4832+
4833+
- template: steps/run-snapshot-test.yml
4834+
parameters:
4835+
target: 'dd-dotnet-chiseled-smoke-tests'
4836+
snapshotPrefix: "smoke_test"
4837+
4838+
- publish: tracer/build_data
4839+
artifact: _$(System.StageName)_$(Agent.JobName)_logs_$(System.JobAttempt)
4840+
condition: succeededOrFailed()
4841+
continueOnError: true
4842+
47644843
- stage: nuget_installer_smoke_tests
47654844
condition: and(succeeded(), eq(variables['isBenchmarksOnlyBuild'], 'False'), or(eq(variables.isMainOrReleaseBranch, 'true'), eq(variables.run_all_installer_tests, 'true')))
47664845
dependsOn: [dotnet_tool, package_windows, generate_variables, merge_commit_id]
@@ -5082,6 +5161,11 @@ stages:
50825161
name: aws-arm64-auto-scaling
50835162

50845163
steps:
5164+
- template: steps/clone-repo.yml
5165+
parameters:
5166+
targetShaId: $(targetShaId)
5167+
targetBranch: $(targetBranch)
5168+
50855169
- task: DownloadPipelineArtifact@2
50865170
displayName: Download artifacts to smoke test directory
50875171
inputs:
@@ -5140,6 +5224,85 @@ stages:
51405224
baseImage: debian
51415225
command: "CheckSmokeTestsForErrors"
51425226

5227+
- stage: installer_chiseled_smoke_tests_arm64
5228+
condition: and(succeeded(), eq(variables['isBenchmarksOnlyBuild'], 'False'), or(eq(variables.isMainOrReleaseBranch, 'true'), eq(variables.run_all_installer_tests, 'true')))
5229+
dependsOn: [package_arm64, generate_variables, merge_commit_id]
5230+
variables:
5231+
targetShaId: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.sha']]
5232+
targetBranch: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.branch']]
5233+
jobs:
5234+
- template: steps/update-github-status-jobs.yml
5235+
parameters:
5236+
jobs: [linux]
5237+
5238+
- job: linux
5239+
timeoutInMinutes: 45 # should take ~15 mins
5240+
strategy:
5241+
matrix: $[ stageDependencies.generate_variables.generate_variables_job.outputs['generate_variables_step.installer_chiseled_smoke_tests_arm64_matrix'] ]
5242+
variables:
5243+
smokeTestAppDir: "$(System.DefaultWorkingDirectory)/tracer/test/test-applications/regression/AspNetCoreSmokeTest"
5244+
pool:
5245+
name: aws-arm64-auto-scaling
5246+
5247+
steps:
5248+
- template: steps/clone-repo.yml
5249+
parameters:
5250+
targetShaId: $(targetShaId)
5251+
targetBranch: $(targetBranch)
5252+
5253+
- task: DownloadPipelineArtifact@2
5254+
displayName: Download artifacts to smoke test directory
5255+
inputs:
5256+
artifact: $(linuxArtifacts)
5257+
path: $(smokeTestAppDir)/artifacts
5258+
5259+
- script: |
5260+
mkdir -p tracer/build_data/snapshots
5261+
mkdir -p tracer/build_data/logs
5262+
displayName: create test data directories
5263+
5264+
# Run the "normal" installer smoke tests
5265+
- script: |
5266+
docker-compose -p ddtrace_$(Build.BuildNumber) build \
5267+
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
5268+
--build-arg RUNTIME_IMAGE=$(runtimeImage) \
5269+
--build-arg PUBLISH_FRAMEWORK=$(publishFramework) \
5270+
chiseled-smoke-tests
5271+
env:
5272+
dockerTag: $(dockerTag)
5273+
DD_LOGGER_DD_API_KEY: $(ddApiKey)
5274+
displayName: docker-compose build chiseled-smoke-tests
5275+
retryCountOnTaskFailure: 3
5276+
5277+
- template: steps/run-snapshot-test.yml
5278+
parameters:
5279+
target: 'chiseled-smoke-tests'
5280+
snapshotPrefix: "smoke_test"
5281+
5282+
# Run the "dd-dotnet" installer smoke tests
5283+
- script: |
5284+
docker-compose -p ddtrace_$(Build.BuildNumber) build \
5285+
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
5286+
--build-arg RUNTIME_IMAGE=$(runtimeImage) \
5287+
--build-arg PUBLISH_FRAMEWORK=$(publishFramework) \
5288+
--build-arg RUNTIME_ID="$(runtimeId)" \
5289+
dd-dotnet-chiseled-arm64-smoke-tests
5290+
env:
5291+
dockerTag: $(dockerTag)
5292+
dockerTarget: $(runtimeId)
5293+
displayName: docker-compose build dd-dotnet-chiseled-arm64-smoke-tests
5294+
retryCountOnTaskFailure: 3
5295+
5296+
- template: steps/run-snapshot-test.yml
5297+
parameters:
5298+
target: 'dd-dotnet-chiseled-arm64-smoke-tests'
5299+
snapshotPrefix: "smoke_test"
5300+
5301+
- publish: tracer/build_data
5302+
artifact: _$(System.StageName)_$(Agent.JobName)_logs_$(System.JobAttempt)
5303+
condition: succeededOrFailed()
5304+
continueOnError: true
5305+
51435306
- stage: nuget_installer_smoke_tests_arm64
51445307
condition: and(succeeded(), eq(variables['isBenchmarksOnlyBuild'], 'False'), or(eq(variables.isMainOrReleaseBranch, 'true'), eq(variables.run_all_installer_tests, 'true')))
51455308
dependsOn: [dotnet_tool, package_windows, generate_variables, merge_commit_id]

docker-compose.yml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: '3.4'
22
services:
33
# ARM64 dependencies
44
localstack_arm64:
@@ -989,6 +989,68 @@ services:
989989
depends_on:
990990
- test-agent
991991

992+
chiseled-smoke-tests:
993+
build:
994+
context: ./tracer/ # have to use this as the context, as Dockercompose requires dockerfile to be inside context dir
995+
dockerfile: build/_build/docker/smoke.chiseled.dockerfile
996+
target: installer-final
997+
# args:
998+
# Note that the following build arguments must be provided
999+
# - DOTNETSDK_VERSION=
1000+
# - RUNTIME_IMAGE=
1001+
# - PUBLISH_FRAMEWORK=
1002+
image: dd-trace-dotnet/${dockerTag:-not-set}-chiseled-tester
1003+
volumes:
1004+
- ./:/project
1005+
- ./tracer/build_data/logs:/var/log/datadog/dotnet
1006+
environment:
1007+
- dockerTag=${dockerTag:-unset}
1008+
- DD_TRACE_AGENT_URL=http://test-agent:8126
1009+
depends_on:
1010+
- test-agent
1011+
1012+
dd-dotnet-chiseled-smoke-tests:
1013+
build:
1014+
context: ./tracer/ # have to use this as the context, as Dockercompose requires dockerfile to be inside context dir
1015+
dockerfile: build/_build/docker/smoke.chiseled.dockerfile
1016+
target: dd-dotnet-final-linux-x64
1017+
# args:
1018+
# Note that the following build arguments must be provided
1019+
# - DOTNETSDK_VERSION=
1020+
# - RUNTIME_IMAGE=
1021+
# - PUBLISH_FRAMEWORK=
1022+
# - RUNTIME_ID=
1023+
image: dd-trace-dotnet/${dockerTag:-not-set}-dd-dotnet-chiseled-tester
1024+
volumes:
1025+
- ./:/project
1026+
- ./tracer/build_data/logs:/var/log/datadog/dotnet
1027+
environment:
1028+
- dockerTag=${dockerTag:-unset}
1029+
- DD_TRACE_AGENT_URL=http://test-agent:8126
1030+
depends_on:
1031+
- test-agent
1032+
1033+
dd-dotnet-chiseled-arm64-smoke-tests:
1034+
build:
1035+
context: ./tracer/ # have to use this as the context, as Dockercompose requires dockerfile to be inside context dir
1036+
dockerfile: build/_build/docker/smoke.chiseled.dockerfile
1037+
target: dd-dotnet-final-linux-arm64
1038+
# args:
1039+
# Note that the following build arguments must be provided
1040+
# - DOTNETSDK_VERSION=
1041+
# - RUNTIME_IMAGE=
1042+
# - PUBLISH_FRAMEWORK=
1043+
# - RUNTIME_ID=
1044+
image: dd-trace-dotnet/${dockerTag:-not-set}-dd-dotnet-arm64-chiseled-tester
1045+
volumes:
1046+
- ./:/project
1047+
- ./tracer/build_data/logs:/var/log/datadog/dotnet
1048+
environment:
1049+
- dockerTag=${dockerTag:-unset}
1050+
- DD_TRACE_AGENT_URL=http://test-agent:8126
1051+
depends_on:
1052+
- test-agent
1053+
9921054
StartDependencies.OSXARM64:
9931055
image: andrewlock/wait-for-dependencies
9941056
depends_on:

tracer/build/_build/Build.VariableGenerations.cs

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ void GenerateSmokeTestsMatrices()
375375
// installer smoke tests
376376
GenerateLinuxInstallerSmokeTestsMatrix();
377377
GenerateLinuxSmokeTestsArm64Matrix();
378+
GenerateLinuxChiseledInstallerSmokeTestsMatrix();
379+
GenerateLinuxChiseledInstallerArm64SmokeTestsMatrix();
378380

379381
// nuget smoke tests
380382
GenerateLinuxNuGetSmokeTestsMatrix();
@@ -405,8 +407,6 @@ void GenerateLinuxInstallerSmokeTestsMatrix()
405407
{
406408
(publishFramework: TargetFramework.NET8_0, "8.0-bookworm-slim"),
407409
(publishFramework: TargetFramework.NET8_0, "8.0-jammy"),
408-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled"), // we can't run scripts in chiseled containers
409-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled-composite"), // we can't run scripts in chiseled containers
410410
(publishFramework: TargetFramework.NET7_0, "7.0-bullseye-slim"),
411411
(publishFramework: TargetFramework.NET6_0, "6.0-bullseye-slim"),
412412
(publishFramework: TargetFramework.NET5_0, "5.0-bullseye-slim"),
@@ -547,6 +547,30 @@ void GenerateLinuxInstallerSmokeTestsMatrix()
547547
AzurePipelines.Instance.SetOutputVariable("installer_smoke_tests_matrix", JsonConvert.SerializeObject(matrix, Formatting.None));
548548
}
549549

550+
void GenerateLinuxChiseledInstallerSmokeTestsMatrix()
551+
{
552+
var matrix = new Dictionary<string, object>();
553+
554+
AddToLinuxSmokeTestsMatrix(
555+
matrix,
556+
"debian",
557+
new (string publishFramework, string runtimeTag)[]
558+
{
559+
(publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled"),
560+
(publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled-composite"),
561+
},
562+
installer: null,
563+
installCmd: null,
564+
linuxArtifacts: "linux-packages-linux-x64",
565+
runtimeId: "linux-x64",
566+
dockerName: "mcr.microsoft.com/dotnet/aspnet"
567+
);
568+
569+
Logger.Information($"Installer chiseled smoke tests matrix");
570+
Logger.Information(JsonConvert.SerializeObject(matrix, Formatting.Indented));
571+
AzurePipelines.Instance.SetOutputVariable("installer_chiseled_smoke_tests_matrix", JsonConvert.SerializeObject(matrix, Formatting.None));
572+
}
573+
550574
void GenerateLinuxSmokeTestsArm64Matrix()
551575
{
552576
var matrix = new Dictionary<string, object>();
@@ -557,8 +581,6 @@ void GenerateLinuxSmokeTestsArm64Matrix()
557581
new (string publishFramework, string runtimeTag)[]
558582
{
559583
(publishFramework: TargetFramework.NET8_0, "8.0-bookworm-slim"),
560-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled"), // we can't run scripts in chiseled containers
561-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled-composite"), // we can't run scripts in chiseled containers
562584
(publishFramework: TargetFramework.NET7_0, "7.0-bullseye-slim"),
563585
(publishFramework: TargetFramework.NET6_0, "6.0-bullseye-slim"),
564586
(publishFramework: TargetFramework.NET5_0, "5.0-bullseye-slim"),
@@ -595,8 +617,6 @@ void GenerateLinuxSmokeTestsArm64Matrix()
595617
new (string publishFramework, string runtimeTag)[]
596618
{
597619
(publishFramework: TargetFramework.NET8_0, "8.0-bookworm-slim"),
598-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled"), // we can't run scripts in chiseled containers
599-
// (publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled-composite"), // we can't run scripts in chiseled containers
600620
(publishFramework: TargetFramework.NET7_0, "7.0-bullseye-slim"),
601621
(publishFramework: TargetFramework.NET6_0, "6.0-bullseye-slim"),
602622
(publishFramework: TargetFramework.NET5_0, "5.0-buster-slim"),
@@ -613,6 +633,30 @@ void GenerateLinuxSmokeTestsArm64Matrix()
613633
AzurePipelines.Instance.SetOutputVariable("installer_smoke_tests_arm64_matrix", JsonConvert.SerializeObject(matrix, Formatting.None));
614634
}
615635

636+
void GenerateLinuxChiseledInstallerArm64SmokeTestsMatrix()
637+
{
638+
var matrix = new Dictionary<string, object>();
639+
640+
AddToLinuxSmokeTestsMatrix(
641+
matrix,
642+
"debian",
643+
new (string publishFramework, string runtimeTag)[]
644+
{
645+
(publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled"),
646+
(publishFramework: TargetFramework.NET8_0, "8.0-jammy-chiseled-composite"),
647+
},
648+
installer: null,
649+
installCmd: null,
650+
linuxArtifacts: "linux-packages-linux-arm64",
651+
runtimeId: "linux-arm64",
652+
dockerName: "mcr.microsoft.com/dotnet/aspnet"
653+
);
654+
655+
Logger.Information($"Installer chiseled smoke tests arm64 matrix");
656+
Logger.Information(JsonConvert.SerializeObject(matrix, Formatting.Indented));
657+
AzurePipelines.Instance.SetOutputVariable("installer_chiseled_smoke_tests_arm64_matrix", JsonConvert.SerializeObject(matrix, Formatting.None));
658+
}
659+
616660
void AddToLinuxSmokeTestsMatrix(
617661
Dictionary<string, object> matrix,
618662
string shortName,
@@ -688,8 +732,8 @@ void GenerateLinuxNuGetSmokeTestsMatrix()
688732
new (string publishFramework, string runtimeTag)[]
689733
{
690734
(publishFramework: TargetFramework.NET8_0, "8.0-alpine3.18"),
691-
// (publishFramework: TargetFramework.NET8_0, "8.0-alpine3.18-chiseled"), // we can't run scripts in chiseled containers, so need to update the dockerfiles
692-
// (publishFramework: TargetFramework.NET7_0, "7.0-alpine3.16"), // we can't run scripts in chiseled containers, so need to update the dockerfiles
735+
(publishFramework: TargetFramework.NET8_0, "8.0-alpine3.18-composite"),
736+
(publishFramework: TargetFramework.NET7_0, "7.0-alpine3.16"),
693737
(publishFramework: TargetFramework.NET6_0, "6.0-alpine3.14"),
694738
(publishFramework: TargetFramework.NET5_0, "5.0-alpine3.14"),
695739
(publishFramework: TargetFramework.NETCOREAPP3_1, "3.1-alpine3.14"),

0 commit comments

Comments
 (0)