Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split tests across multiple VMSets #21075

Merged
merged 46 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0db2ad9
parallelize kmt tests
usamasaqib Nov 22, 2023
8104cd6
shorten URNs
usamasaqib Nov 23, 2023
5a8b9fc
add test set suffix to CI visibility related files
usamasaqib Nov 23, 2023
413b925
add test set suffix to artifacts
usamasaqib Nov 23, 2023
92444dc
pass tests to run as configuration
usamasaqib Nov 23, 2023
8bc22af
run tests with new configuration
usamasaqib Nov 23, 2023
672e2d7
simplify
usamasaqib Nov 23, 2023
671d13b
fix runner_CMD
usamasaqib Nov 23, 2023
d441d12
read config data from file
usamasaqib Nov 23, 2023
873a6f8
organize files
usamasaqib Nov 23, 2023
0e6937b
prints testnames
usamasaqib Nov 23, 2023
0c70eea
fix compilation
usamasaqib Nov 23, 2023
cd5d4f5
update test-infra runner
usamasaqib Nov 24, 2023
ab15e0b
add to task to generate vmconfig.json at runtime
usamasaqib Nov 28, 2023
33b7f02
generate configuration file
usamasaqib Nov 28, 2023
a56cf13
avoid use of uninstalled library in ci
usamasaqib Nov 28, 2023
af4e34e
fix file open
usamasaqib Nov 28, 2023
cc21f89
pass vmconfig file in the ci
usamasaqib Nov 28, 2023
fd2be6e
add sets into vmconfig file
usamasaqib Nov 28, 2023
6f24f96
full path to vmconfig file
usamasaqib Nov 28, 2023
56a78a3
pass output file parameter
usamasaqib Nov 28, 2023
c03ac09
fix parameter name
usamasaqib Nov 28, 2023
fe2ed9a
make disk into list
usamasaqib Nov 28, 2023
b0167aa
lint
usamasaqib Nov 28, 2023
3e4ab80
pass test sets
usamasaqib Nov 28, 2023
c470aca
make vmconfig file global
usamasaqib Nov 28, 2023
01945bf
remove arch specific file
usamasaqib Nov 28, 2023
b3b2753
use tags in vmconfig file instead of names
usamasaqib Nov 29, 2023
e77a527
exact match on domain name
usamasaqib Nov 29, 2023
b7578fa
make include explicit
usamasaqib Nov 29, 2023
0f10aac
run and skip are lists
usamasaqib Nov 29, 2023
579e105
use wildcard to only signify includes
usamasaqib Nov 29, 2023
73027f8
keep single test job per arch
usamasaqib Nov 29, 2023
14c580b
use grep pattern everywhere
usamasaqib Nov 29, 2023
ff15323
fix needs for cleanup jobs
usamasaqib Nov 29, 2023
ce7ba11
separte junit upload jobs by architecture
usamasaqib Nov 29, 2023
946559a
fix test-runner configuration file names
usamasaqib Nov 29, 2023
7df6446
python-linting
usamasaqib Nov 29, 2023
577d9af
fix sorting
usamasaqib Nov 29, 2023
233575e
update test-infra
usamasaqib Nov 29, 2023
282dc49
update test-infra runner image
usamasaqib Nov 29, 2023
f315f3c
fix import sorting
usamasaqib Nov 29, 2023
6b591be
remove unused variables
usamasaqib Nov 29, 2023
98e4511
remote unused vmconfig file
usamasaqib Nov 30, 2023
7bb6b75
Update tasks/kernel_matrix_testing/vmconfig.py
usamasaqib Dec 1, 2023
683b7e2
remove arch mapping
usamasaqib Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ variables:
# To use images from test-infra-definitions dev branches, set the SUFFIX variable to -dev
# and check the job creating the image to make sure you have the right SHA prefix
TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: ""
TEST_INFRA_DEFINITIONS_BUILDIMAGES: a60850d5606e
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 40b046c22010
DATADOG_AGENT_BUILDERS: v22276738-b36b132

DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,12 @@ functional_test_junit_upload_system_probe:
- set -x
- ss=0; for f in $DD_AGENT_TESTING_DIR/kitchen-junit-*.tar.gz; do [[ -e "$f" ]] || continue; inv -e junit-upload --tgz-path $f || ((ss++)); done; exit $ss

functional_test_junit_upload_system_probe_kmt:
.functional_test_junit_upload_system_probe_kmt:
stage: functional_test_junit_upload
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/datadog-ci-uploader$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
allow_failure: true
when: always
needs:
- job: kernel_matrix_testing_run_tests_x64
optional: true
- job: kernel_matrix_testing_run_tests_arm64
optional: true
variables:
DD_ENV: ci
script:
Expand All @@ -42,3 +37,19 @@ functional_test_junit_upload_system_probe_kmt:
- export JIRA_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.jira_read_api_token --with-decryption --query "Parameter.Value" --out text)
- set -x
- ss=0; for f in $DD_AGENT_TESTING_DIR/junit-*.tar.gz; do [[ -e "$f" ]] || continue; inv -e junit-upload --tgz-path $f || ((ss++)); done; exit $ss

# junit upload jobs are separted because of gitlab limit on the number of jobs
# a single job can 'need'.
functional_test_junit_upload_system_probe_kmt_x64:
extends:
- .functional_test_junit_upload_system_probe_kmt
needs:
- job: kernel_matrix_testing_run_tests_x64
optional: true

functional_test_junit_upload_system_probe_kmt_arm64:
extends:
- .functional_test_junit_upload_system_probe_kmt
needs:
- job: kernel_matrix_testing_run_tests_arm64
optional: true
36 changes: 21 additions & 15 deletions .gitlab/kernel_version_testing/system_probe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ upload_dependencies_arm64:
- cp -R $KITCHEN_TESTS $SYSTEM_PROBE_TESTS
- pushd $CI_PROJECT_DIR/test/new-e2e/system-probe/test-runner && go build -o $DEPENDENCIES/test-runner && popd
- pushd $CI_PROJECT_DIR/test/new-e2e/system-probe/test-json-review && go build -o $DEPENDENCIES/test-json-review && popd
- cp $CI_PROJECT_DIR/test/new-e2e/system-probe/test-runner/files/*.json $DEPENDENCIES/
- popd
# package all the dependencies
- ls -la $DEPENDENCIES
Expand Down Expand Up @@ -291,6 +292,8 @@ upload_minimized_btfs_arm64:
RESOURCE_TAGS: "instance-type:${INSTANCE_TYPE},arch:${ARCH}"
KUBERNETES_MEMORY_REQUEST: "12Gi"
KUBERNETES_MEMORY_LIMIT: "16Gi"
VMCONFIG_FILE: "${CI_PROJECT_DIR}/vmconfig-${CI_PIPELINE_ID}-${ARCH}.json"
TEST_SETS: "no_tracersuite,only_tracersuite"
before_script:
- set +x
- export DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.datadog_api_key_org2 --with-decryption --query "Parameter.Value" --out text)
Expand All @@ -301,7 +304,8 @@ upload_minimized_btfs_arm64:
script:
- echo "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" > $STACK_DIR
- pulumi login $(cat $STACK_DIR | tr -d '\n')
- inv -e system-probe.start-microvms --provision --vmconfig=$VMCONFIG_PATH $INSTANCE_TYPE_ARG $AMI_ID_ARG --ssh-key-name=$AWS_EC2_SSH_KEY_NAME --ssh-key-path=$AWS_EC2_SSH_KEY_FILE --infra-env=$INFRA_ENV --stack-name=kernel-matrix-testing-$ARCH-$CI_PIPELINE_ID --run-agent
- inv -e kmt.gen-config --ci --arch=$ARCH --output-file=$VMCONFIG_FILE --sets=$TEST_SETS
- inv -e system-probe.start-microvms --provision --vmconfig=$VMCONFIG_FILE $INSTANCE_TYPE_ARG $AMI_ID_ARG --ssh-key-name=$AWS_EC2_SSH_KEY_NAME --ssh-key-path=$AWS_EC2_SSH_KEY_FILE --infra-env=$INFRA_ENV --stack-name=kernel-matrix-testing-$ARCH-$CI_PIPELINE_ID --run-agent
- cat $CI_PROJECT_DIR/stack.output
- pulumi logout
after_script:
Expand All @@ -317,6 +321,7 @@ upload_minimized_btfs_arm64:
paths:
- $CI_PROJECT_DIR/stack.output
- $CI_PROJECT_DIR/libvirt
- $VMCONFIG_FILE

kernel_matrix_testing_setup_env_arm64:
extends:
Expand All @@ -327,7 +332,6 @@ kernel_matrix_testing_setup_env_arm64:
ARCH: arm64
AMI_ID_ARG: "--arm-ami-id=$KERNEL_MATRIX_TESTING_ARM_AMI_ID"
LibvirtSSHKey: $CI_PROJECT_DIR/libvirt_rsa-arm
VMCONFIG_PATH: $CI_PROJECT_DIR/test/new-e2e/system-probe/config/vmconfig-arm64.json

kernel_matrix_testing_setup_env_x64:
extends:
Expand All @@ -338,7 +342,6 @@ kernel_matrix_testing_setup_env_x64:
ARCH: x86_64
AMI_ID_ARG: "--x86-ami-id=$KERNEL_MATRIX_TESTING_X86_AMI_ID"
LibvirtSSHKey: $CI_PROJECT_DIR/libvirt_rsa-x86
VMCONFIG_PATH: $CI_PROJECT_DIR/test/new-e2e/system-probe/config/vmconfig-x64.json

.kernel_matrix_testing_run_tests:
stage: kernel_matrix_testing
Expand All @@ -348,6 +351,7 @@ kernel_matrix_testing_setup_env_x64:
variables:
AWS_EC2_SSH_KEY_FILE: $CI_PROJECT_DIR/ssh_key
RETRY: 2
MICROVM_GREP_PATTERN: "$ARCH-$TAG-.*$TEST_SET.*-ddvm"
brycekahle marked this conversation as resolved.
Show resolved Hide resolved
before_script:
- set +x
- export DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.datadog_api_key_org2 --with-decryption --query "Parameter.Value" --out text)
Expand All @@ -367,28 +371,28 @@ kernel_matrix_testing_setup_env_x64:
echo "These jobs do not permit retries. The go tests are retried a user-specified number of times automatically. In order to re-run the tests, you must trigger the pipeline again"
'false'
fi
- MICRO_VM_IP=$(cat $CI_PROJECT_DIR/stack.output | grep $ARCH-$TAG | cut -d ' ' -f 2)
- MICRO_VM_NAME=$(cat $CI_PROJECT_DIR/stack.output | grep $ARCH-$TAG | cut -d ' ' -f 1)
- MICRO_VM_IP=$(cat $CI_PROJECT_DIR/stack.output | grep $MICROVM_GREP_PATTERN | cut -d ' ' -f 2)
- MICRO_VM_NAME=$(cat $CI_PROJECT_DIR/stack.output | grep $MICROVM_GREP_PATTERN | cut -d ' ' -f 1)
- GO_VERSION=$(inv go-version)
- !reference [.setup_ssh_config]
# ssh into each micro-vm and run initialization script. This script will also run the tests.
- scp "$DD_AGENT_TESTING_DIR/job_env.txt" "metal_instance:/home/ubuntu/job_env-${ARCH}-${TAG}.txt"
- ssh metal_instance "scp /home/ubuntu/job_env-${ARCH}-${TAG}.txt ${MICRO_VM_IP}:/job_env.txt"
- NESTED_VM_CMD="/home/ubuntu/connector -host ${MICRO_VM_IP} -user root -ssh-file /home/kernel-version-testing/ddvm_rsa -vm-cmd 'bash /root/fetch_dependencies.sh ${ARCH} && /micro-vm-init.sh ${RETRY}'"
- scp "$DD_AGENT_TESTING_DIR/job_env.txt" "metal_instance:/home/ubuntu/job_env-${ARCH}-${TAG}-${TEST_SET}.txt"
- ssh metal_instance "scp /home/ubuntu/job_env-${ARCH}-${TAG}-${TEST_SET}.txt ${MICRO_VM_IP}:/job_env.txt"
- NESTED_VM_CMD="/home/ubuntu/connector -host ${MICRO_VM_IP} -user root -ssh-file /home/kernel-version-testing/ddvm_rsa -vm-cmd 'bash /root/fetch_dependencies.sh ${ARCH} && /micro-vm-init.sh ${RETRY} /${TEST_SET}.json'"
- $CI_PROJECT_DIR/connector-$ARCH -host $INSTANCE_IP -user ubuntu -ssh-file $AWS_EC2_SSH_KEY_FILE -vm-cmd "${NESTED_VM_CMD}"
- ssh metal_instance "ssh ${MICRO_VM_IP} '/test-json-review'"
after_script:
- MICRO_VM_IP=$(cat $CI_PROJECT_DIR/stack.output | grep $ARCH-$TAG | cut -d ' ' -f 2)
- ssh metal_instance "scp ${MICRO_VM_IP}:/ci-visibility/junit.tar.gz /home/ubuntu/junit-${ARCH}-${TAG}.tar.gz"
- scp "metal_instance:/home/ubuntu/junit-${ARCH}-${TAG}.tar.gz" $DD_AGENT_TESTING_DIR/
- ssh metal_instance "scp ${MICRO_VM_IP}:/ci-visibility/testjson.tar.gz /home/ubuntu/testjson-${ARCH}-${TAG}.tar.gz"
- scp "metal_instance:/home/ubuntu/testjson-${ARCH}-${TAG}.tar.gz" $DD_AGENT_TESTING_DIR/
- MICRO_VM_IP=$(cat $CI_PROJECT_DIR/stack.output | grep $MICROVM_GREP_PATTERN | cut -d ' ' -f 2)
- ssh metal_instance "scp ${MICRO_VM_IP}:/ci-visibility/junit.tar.gz /home/ubuntu/junit-${ARCH}-${TAG}-${TEST_SET}.tar.gz"
- scp "metal_instance:/home/ubuntu/junit-${ARCH}-${TAG}-${TEST_SET}.tar.gz" $DD_AGENT_TESTING_DIR/
- ssh metal_instance "scp ${MICRO_VM_IP}:/ci-visibility/testjson.tar.gz /home/ubuntu/testjson-${ARCH}-${TAG}-${TEST_SET}.tar.gz"
- scp "metal_instance:/home/ubuntu/testjson-${ARCH}-${TAG}-${TEST_SET}.tar.gz" $DD_AGENT_TESTING_DIR/
artifacts:
expire_in: 2 weeks
when: always
paths:
- $DD_AGENT_TESTING_DIR/junit-$ARCH-$TAG.tar.gz
- $DD_AGENT_TESTING_DIR/testjson-$ARCH-$TAG.tar.gz
- $DD_AGENT_TESTING_DIR/junit-$ARCH-$TAG-$TEST_SET.tar.gz
- $DD_AGENT_TESTING_DIR/testjson-$ARCH-$TAG-$TEST_SET.tar.gz

kernel_matrix_testing_run_tests_x64:
extends:
Expand All @@ -402,6 +406,7 @@ kernel_matrix_testing_run_tests_x64:
parallel:
matrix:
- TAG: ["ubuntu_16.04", "ubuntu_18.04", "ubuntu_20.04", "ubuntu_22.04", "ubuntu_23.10", "amzn_4.14", "amzn_5.4", "amzn_5.10", "fedora_37", "fedora_38", "debian_10", "debian_11", "debian_12", "centos_79", "centos_8"]
TEST_SET: ["no_tracersuite", "only_tracersuite"]

kernel_matrix_testing_run_tests_arm64:
extends:
Expand All @@ -415,6 +420,7 @@ kernel_matrix_testing_run_tests_arm64:
parallel:
matrix:
- TAG: ["ubuntu_18.04", "ubuntu_20.04", "ubuntu_22.04", "ubuntu_23.10", "amzn_4.14", "amzn_5.4", "amzn_5.10", "fedora_37", "fedora_38", "debian_10", "debian_11", "debian_12", "centos_79", "centos_8"]
TEST_SET: ["no_tracersuite", "only_tracersuite"]

.kernel_matrix_testing_cleanup:
stage: kernel_matrix_testing
Expand Down
Loading