diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e631d78915..11db5429d7f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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" 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 <