-
Notifications
You must be signed in to change notification settings - Fork 351
Deduplicate GitLab test job templates #12199
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -685,35 +685,18 @@ muzzle-dep-report: | |
| .restore_pretest_env: &restore_pretest_env | ||
| - source pretest.env | ||
|
|
||
| .test_job: | ||
| .test_job_common: | ||
| extends: .gradle_build | ||
| image: ${BUILDER_IMAGE_REPO}:${BUILDER_IMAGE_VERSION_PREFIX}$testJvm | ||
| tags: [ "docker-in-docker:amd64" ] # use docker-in-docker runner for testcontainers | ||
| needs: [ build_tests ] | ||
| stage: tests | ||
| variables: | ||
| <<: *tier_m_variables | ||
| GRADLE_PARAMS: "-PskipFlakyTests" | ||
| CONTINUE_ON_FAILURE: "false" | ||
| TEST_JVM_ARGS: "" | ||
| TESTCONTAINERS_CHECKS_DISABLE: "true" | ||
| TESTCONTAINERS_RYUK_DISABLED: "true" | ||
| TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: "registry.ddbuild.io/images/mirror/" | ||
| JETTY_AVAILABLE_PROCESSORS: 4 # Jetty incorrectly calculates processor count in containers | ||
| rules: | ||
| # Protected branches (master/mq/gh-readonly): all JVMs run unconditionally | ||
| - if: '$CI_COMMIT_BRANCH == "master"' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_BRANCH =~ /^mq-working-branch-/' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_BRANCH =~ /^gh-readonly-queue/' | ||
| when: on_success | ||
| # Enable for default test JVMs or for NON_DEFAULT_JVMS | ||
| - if: '$NON_DEFAULT_JVMS == "true"' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_MESSAGE =~ /\[ci: NON_DEFAULT_JVMS\]/' | ||
| when: on_success | ||
| - if: '$testJvm =~ $DEFAULT_TEST_JVMS' | ||
| when: on_success | ||
| script: | ||
| - *gitlab_base_ref_params | ||
| - > | ||
|
|
@@ -722,7 +705,7 @@ muzzle-dep-report: | |
| export PROFILER_COMMAND="-XX:StartFlightRecording=settings=profile,filename=/tmp/${CI_JOB_NAME_SLUG}.jfr,dumponexit=true"; | ||
| fi | ||
| - *prepare_test_env | ||
| - export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX $PROFILER_COMMAND -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.util.prefs.userRoot=/tmp/.java/.userPrefs-${CI_JOB_ID}' -Ddatadog.forkedMinHeapSize=128M -Ddatadog.forkedMaxHeapSize=1024M" | ||
| - export GRADLE_OPTS="-Dorg.gradle.jvmargs='$TEST_JVM_ARGS -Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX $PROFILER_COMMAND -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.util.prefs.userRoot=/tmp/.java/.userPrefs-${CI_JOB_ID}' -Ddatadog.forkedMinHeapSize=128M -Ddatadog.forkedMaxHeapSize=1024M" | ||
| - ./gradlew --version | ||
| - ./gradlew $GRADLE_TARGET $GRADLE_PARAMS -PtestJvm=$testJvm -Pslot=$CI_NODE_INDEX/$CI_NODE_TOTAL $GRADLE_ARGS --continue || $CONTINUE_ON_FAILURE | ||
| after_script: | ||
|
|
@@ -767,24 +750,44 @@ muzzle-dep-report: | |
| - scheduler_failure | ||
| - data_integrity_failure | ||
|
|
||
| .test_job: | ||
| extends: .test_job_common | ||
| tags: [ "docker-in-docker:amd64" ] # use docker-in-docker runner for testcontainers | ||
| needs: [ build_tests ] | ||
| stage: tests | ||
| rules: | ||
| # Protected branches (master/mq/gh-readonly): all JVMs run unconditionally | ||
| - if: '$CI_COMMIT_BRANCH == "master"' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_BRANCH =~ /^mq-working-branch-/' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_BRANCH =~ /^gh-readonly-queue/' | ||
| when: on_success | ||
| # Enable for default test JVMs or for NON_DEFAULT_JVMS | ||
| - if: '$NON_DEFAULT_JVMS == "true"' | ||
| when: on_success | ||
| - if: '$CI_COMMIT_MESSAGE =~ /\[ci: NON_DEFAULT_JVMS\]/' | ||
| when: on_success | ||
| - if: '$testJvm =~ $DEFAULT_TEST_JVMS' | ||
| when: on_success | ||
|
|
||
| .test_job_arm64: | ||
| image: ${BUILDER_IMAGE_REPO}:${BUILDER_IMAGE_VERSION_PREFIX}$testJvm | ||
| extends: .test_job_common | ||
| tags: [ "docker-in-docker:arm64" ] | ||
| stage: tests-arm64 | ||
| needs: [] | ||
| # Use the amd64 build only as a compilation gate. Do not download its platform-specific artifacts. | ||
| needs: | ||
| - job: build | ||
| artifacts: false | ||
| variables: | ||
| <<: *tier_m_variables | ||
| DEFAULT_TEST_JVMS: /^(8|11|17|21|25|27|tip)$/ # Java 27 TODO: remove 27 after GA (tip will move to 27) | ||
| GRADLE_PARAMS: "-PskipFlakyTests" | ||
| TESTCONTAINERS_CHECKS_DISABLE: "true" | ||
| TESTCONTAINERS_RYUK_DISABLED: "true" | ||
| TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: "registry.ddbuild.io/images/mirror/" | ||
| JETTY_AVAILABLE_PROCESSORS: 4 | ||
| GIT_SUBMODULE_STRATEGY: normal | ||
| GIT_SUBMODULE_DEPTH: 1 | ||
| TEST_JVM_ARGS: "-Xshare:off" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: It might be a good thing to comment why this is needed. Honestly I didn't dived into why this was needed, I know it disables class data dharing (CDS) which is used to speed up JVM botstrap, that said this mechanism evolved overt JVM releases so I'm not sure what's at play regarding ARM64 in more recent versions.
If issues arose, I wonder if Linux memory pages are at play when running on ARM64, unusually these systems may use 4 KiB, 16 KiB, or 64 KiB memory pages. And I wonder if the CDS archive has some issues with memory alignment on unusual page size, that said I can be completely off-track. However about the "trade-off", I would mention slightly slower jvm bootstrap, and maybe a tad higher memory use.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: It's just a thought, but interestingly, I wonder if the env var can be picked up, by programmatic launches that are using this all over the place, we might be able to drop the That said, maybe, this env var need to be more specific? E.g. |
||
| rules: | ||
| # `ibm8`/`oracle8` have no arm64 images published upstream — never run them on arm64. | ||
| - if: '$testJvm == "ibm8" || $testJvm == "oracle8"' | ||
| # IBM 8 has no arm64 image published upstream. | ||
| - if: '$testJvm == "ibm8"' | ||
| when: never | ||
| # Oracle 8 is available on arm64 but too flaky to run in CI. | ||
| - if: '$testJvm == "oracle8"' | ||
| when: never | ||
| # arm64 tests are newly introduced to the merge queue and master. Keep them | ||
| # non-blocking (allow_failure) for now so we can collect stability stats and | ||
|
|
@@ -803,6 +806,7 @@ muzzle-dep-report: | |
| - if: '$CI_COMMIT_MESSAGE =~ /\[ci: NON_DEFAULT_JVMS\]/' | ||
| when: on_success | ||
| allow_failure: true | ||
| # Keep the default JVM subset available for manual runs on feature branches/PRs. | ||
| - if: '$testJvm =~ $DEFAULT_TEST_JVMS' | ||
| when: manual | ||
| allow_failure: true | ||
|
|
@@ -820,75 +824,9 @@ muzzle-dep-report: | |
| unprotect: true | ||
| before_script: | ||
| - git config --global --add safe.directory "$CI_PROJECT_DIR" | ||
| # Akka token added to SSM from https://account.akka.io/token | ||
| - export ORG_GRADLE_PROJECT_akkaRepositoryToken=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.akka_repo_token --with-decryption --query "Parameter.Value" --out text) | ||
| - export ORG_GRADLE_PROJECT_mavenRepositoryProxy=$MAVEN_REPOSITORY_PROXY | ||
| - export ORG_GRADLE_PROJECT_gradlePluginProxy=$GRADLE_PLUGIN_PROXY | ||
| - | | ||
| JAVA_HOMES=$(env | grep -E '^JAVA_[A-Z0-9_]+_HOME=' | sed 's/=.*//' | paste -sd,) | ||
| cat >> gradle.properties <<EOF | ||
| org.gradle.java.installations.auto-detect=false | ||
| org.gradle.java.installations.auto-download=false | ||
| org.gradle.java.installations.fromEnv=$JAVA_HOMES | ||
| EOF | ||
| - mkdir -p .gradle .mvn/caches | ||
| # GitLab's cache helper restores .gradle as root, but we run as non-root-user (uid 1001), | ||
| # and Gradle does `chmod 700 .gradle` on startup which requires user ownership. | ||
| - sudo chown -R 1001:1001 .gradle | ||
| - export GRADLE_USER_HOME=$(pwd)/.gradle | ||
| # Apache Maven Wrapper supports MVNW_REPOURL for repository-manager downloads: | ||
| # https://maven.apache.org/tools/wrapper/#Using_a_Maven_Repository_Manager | ||
| - export MVNW_REPOURL=${MAVEN_REPOSITORY_PROXY%/} | ||
| # Route Gradle distribution download through MASS pull-through cache | ||
| - | | ||
| mass_read_host="${MASS_READ_URL#https://}" | ||
| mass_read_host="${mass_read_host%/}" | ||
| sed -i "/^distributionUrl=/ s|services.gradle.org|${mass_read_host}/internal/artifact/services.gradle.org|" gradle/wrapper/gradle-wrapper.properties | ||
| - *normalize_node_index | ||
| - *prepare_test_env | ||
| # Disable CDS in forked JVMs to avoid SIGSEGVs on Linux arm64. | ||
| - export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xshare:off -Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.util.prefs.userRoot=/tmp/.java/.userPrefs-${CI_JOB_ID}' -Ddatadog.forkedMinHeapSize=128M -Ddatadog.forkedMaxHeapSize=1024M" | ||
| - export GRADLE_ARGS="--build-cache --stacktrace --no-daemon --parallel --max-workers=$GRADLE_WORKERS" | ||
| - ./gradlew --version | ||
| script: | ||
| - *gitlab_base_ref_params | ||
| - ./gradlew $GRADLE_TARGET $GRADLE_PARAMS -PtestJvm=$testJvm -Pslot=$CI_NODE_INDEX/$CI_NODE_TOTAL $GRADLE_ARGS --continue | ||
| after_script: | ||
| - *restore_pretest_env | ||
| - *set_datadog_api_keys | ||
| - *container_info | ||
| - *cgroup_info | ||
| - source .gitlab/gitlab-utils.sh | ||
| - gitlab_section_start "collect-reports" "Collecting reports" | ||
| - .gitlab/collect_reports.sh | ||
| - .gitlab/collect_results.sh | ||
| - .gitlab/upload_ciapp.sh $CACHE_TYPE $testJvm | ||
| - gitlab_section_end "collect-reports" | ||
| - .gitlab/count_tests.sh "$GRADLE_TARGET" "$testJvm" "./results" "./test_counts_${CI_JOB_ID}.json" | ||
| - URL_ENCODED_JOB_NAME=$(jq -rn --arg x "$CI_JOB_NAME" '$x|@uri') | ||
| - echo -e "${TEXT_BOLD}${TEXT_YELLOW}See test results in Datadog:${TEXT_CLEAR} https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40test.service%3Add-trace-java%20%40ci.pipeline.id%3A${CI_PIPELINE_ID}%20%40ci.job.name%3A%22${URL_ENCODED_JOB_NAME}%22" | ||
| artifacts: | ||
| when: always | ||
| paths: | ||
| - ./reports.tar | ||
| - ./profiles.tar | ||
| - ./results | ||
| - './test_counts_*.json' | ||
| - '.gradle/daemon/*/*.out.log' | ||
| reports: | ||
| junit: results/*.xml | ||
| retry: | ||
| max: 2 | ||
| when: | ||
| - unknown_failure | ||
| - stuck_or_timeout_failure | ||
| - runner_system_failure | ||
| - unmet_prerequisites | ||
| - scheduler_failure | ||
| - data_integrity_failure | ||
| - !reference [.gradle_build, before_script] | ||
|
|
||
| .test_job_arm64_with_test_agent: | ||
| extends: .test_job_arm64 | ||
| .test_job_with_test_agent_common: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: I'd make architecture explicit |
||
| variables: | ||
| CI_USE_TEST_AGENT: "true" | ||
| CI_AGENT_HOST: local-agent | ||
|
|
@@ -903,27 +841,18 @@ muzzle-dep-report: | |
| DD_DISABLE_ERROR_RESPONSES: "true" | ||
| ENABLED_CHECKS: "trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service" | ||
| script: | ||
| - !reference [.test_job_arm64, script] | ||
| - !reference [.test_job_common, script] | ||
| - .gitlab/check_test_agent_results.sh | ||
|
|
||
| .test_job_with_test_agent: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: I'd make architecture explicit |
||
| extends: .test_job | ||
| variables: | ||
| CI_USE_TEST_AGENT: "true" | ||
| CI_AGENT_HOST: local-agent | ||
| services: | ||
| - name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.64.1 | ||
| alias: local-agent | ||
| variables: | ||
| LOG_LEVEL: "DEBUG" | ||
| TRACE_LANGUAGE: "java" | ||
| DD_SUPPRESS_TRACE_PARSE_ERRORS: "true" | ||
| DD_POOL_TRACE_CHECK_FAILURES: "true" | ||
| DD_DISABLE_ERROR_RESPONSES: "true" | ||
| ENABLED_CHECKS: "trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service" | ||
| script: | ||
| - !reference [.test_job, script] | ||
| - .gitlab/check_test_agent_results.sh | ||
| extends: | ||
| - .test_job | ||
| - .test_job_with_test_agent_common | ||
|
|
||
| .test_job_arm64_with_test_agent: | ||
| extends: | ||
| - .test_job_arm64 | ||
| - .test_job_with_test_agent_common | ||
|
|
||
| agent_integration_tests: | ||
| extends: .test_job | ||
|
|
@@ -960,7 +889,7 @@ test_base: | |
| matrix: *test_matrix_4 | ||
| script: | ||
| - if [ "$testJvm" == "8" ]; then export GRADLE_PARAMS="-PskipFlakyTests -PcheckCoverage"; fi | ||
| - !reference [.test_job, script] | ||
| - !reference [.test_job_common, script] | ||
|
|
||
| test_base_arm64: | ||
| extends: .test_job_arm64 | ||
|
|
@@ -972,7 +901,7 @@ test_base_arm64: | |
| # run coverage only on JVM 8, mirroring the amd64 test_base job | ||
| script: | ||
| - if [ "$testJvm" == "8" ]; then export GRADLE_PARAMS="$GRADLE_PARAMS -PcheckCoverage"; fi | ||
| - !reference [.test_job_arm64, script] | ||
| - !reference [.test_job_common, script] | ||
|
|
||
| test_inst: | ||
| extends: .test_job_with_test_agent | ||
|
|
@@ -1100,7 +1029,7 @@ test_debugger: | |
| # exepected coverage | ||
| script: | ||
| - if [[ "$testJvm" != "semeru8" && "$testJvm" != "semeru11" && "$testJvm" != "semeru17" && "$testJvm" != "ibm8" ]]; then export GRADLE_PARAMS="$GRADLE_PARAMS -PcheckCoverage"; fi | ||
| - !reference [.test_job, script] | ||
| - !reference [.test_job_common, script] | ||
|
|
||
| test_debugger_arm64: | ||
| extends: .test_job_arm64 | ||
|
|
@@ -1113,7 +1042,7 @@ test_debugger_arm64: | |
| # expected coverage (ibm8/oracle8 never run on arm64) | ||
| script: | ||
| - if [[ "$testJvm" != "semeru8" && "$testJvm" != "semeru11" && "$testJvm" != "semeru17" ]]; then export GRADLE_PARAMS="$GRADLE_PARAMS -PcheckCoverage"; fi | ||
| - !reference [.test_job_arm64, script] | ||
| - !reference [.test_job_common, script] | ||
|
|
||
| test_smoke: | ||
| extends: .test_job_with_test_agent | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I'd make the arcvhitecture explicit for
amd64