diff --git a/.github/actions/gradle-enterprise/action.yml b/.github/actions/gradle-enterprise/action.yml new file mode 100644 index 0000000000000..935e76d3cd645 --- /dev/null +++ b/.github/actions/gradle-enterprise/action.yml @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: Configure Gradle Enterprise integration +description: Configure Gradle Enterprise when secret GE_ACCESS_TOKEN is available +inputs: + token: + description: 'The token for accessing Gradle Enterprise' + required: true +runs: + using: composite + steps: + - run: | + if [[ -n "${{ inputs.token }}" ]]; then + echo "::group::Configuring Gradle Enterprise for build" + cp .mvn/ge-extensions.xml .mvn/extensions.xml + echo "GRADLE_ENTERPRISE_ACCESS_KEY=${{ inputs.token }}" >> $GITHUB_ENV + echo "::endgroup::" + fi + shell: bash \ No newline at end of file diff --git a/.github/workflows/ci-maven-cache-update.yaml b/.github/workflows/ci-maven-cache-update.yaml index daba3dcc0321e..831a2866bea68 100644 --- a/.github/workflows/ci-maven-cache-update.yaml +++ b/.github/workflows/ci-maven-cache-update.yaml @@ -47,6 +47,8 @@ env: jobs: update-maven-dependencies-cache: name: Update Maven dependency cache for ${{ matrix.name }} + env: + JOB_NAME: Update Maven dependency cache for ${{ matrix.name }} runs-on: ${{ matrix.runs-on }} timeout-minutes: 45 @@ -75,6 +77,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Detect changed files if: ${{ github.event_name != 'schedule' }} id: changes diff --git a/.github/workflows/ci-owasp-dependency-check.yaml b/.github/workflows/ci-owasp-dependency-check.yaml index 38bd7f9eec419..9ee9c8c46b365 100644 --- a/.github/workflows/ci-owasp-dependency-check.yaml +++ b/.github/workflows/ci-owasp-dependency-check.yaml @@ -28,7 +28,9 @@ env: jobs: run-owasp-dependency-check: if: ${{ github.repository == 'apache/pulsar' }} - name: Run OWASP Dependency Check + name: Run OWASP Dependency Check for ${{ matrix.name }} + env: + JOB_NAME: Run OWASP Dependency Check for ${{ matrix.name }} runs-on: ubuntu-20.04 timeout-minutes: 45 strategy: @@ -55,6 +57,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Cache local Maven repository uses: actions/cache@v3 with: diff --git a/.github/workflows/pulsar-ci-flaky.yaml b/.github/workflows/pulsar-ci-flaky.yaml index 35315d07a7b77..e201d379d9392 100644 --- a/.github/workflows/pulsar-ci-flaky.yaml +++ b/.github/workflows/pulsar-ci-flaky.yaml @@ -69,6 +69,8 @@ jobs: build-and-test: needs: preconditions name: Flaky tests suite + env: + JOB_NAME: Flaky tests suite runs-on: ubuntu-20.04 timeout-minutes: 100 if: ${{ needs.preconditions.outputs.docs_only != 'true' }} @@ -79,6 +81,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml index 3570bdc8a7806..665a1cb5a0764 100644 --- a/.github/workflows/pulsar-ci.yaml +++ b/.github/workflows/pulsar-ci.yaml @@ -46,7 +46,7 @@ jobs: docs_only: ${{ steps.check_changes.outputs.docs_only }} changed_tests: ${{ steps.changes.outputs.tests_files }} need_owasp: ${{ steps.changes.outputs.need_owasp }} - + steps: - name: checkout uses: actions/checkout@v3 @@ -75,6 +75,8 @@ jobs: build-and-license-check: needs: preconditions name: Build and License check + env: + JOB_NAME: Build and License check runs-on: ubuntu-20.04 timeout-minutes: 60 if: ${{ needs.preconditions.outputs.docs_only != 'true' }} @@ -85,6 +87,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -146,6 +153,8 @@ jobs: unit-tests: name: CI - Unit - ${{ matrix.name }} + env: + JOB_NAME: CI - Unit - ${{ matrix.name }} runs-on: ubuntu-20.04 timeout-minutes: ${{ matrix.timeout || 60 }} needs: ['preconditions', 'build-and-license-check'] @@ -171,6 +180,7 @@ jobs: group: PROXY - name: Pulsar IO group: PULSAR_IO + timeout: 75 - name: Pulsar Client group: CLIENT @@ -181,6 +191,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -283,6 +298,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -341,6 +361,7 @@ jobs: needs: ['preconditions', 'pulsar-java-test-image'] if: ${{ needs.preconditions.outputs.docs_only != 'true' }} env: + JOB_NAME: CI - Integration - ${{ matrix.name }} PULSAR_TEST_IMAGE_NAME: apachepulsar/java-test-image:latest strategy: fail-fast: false @@ -382,6 +403,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -490,6 +516,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Install gh-actions-artifact-client.js uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master @@ -512,6 +543,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -603,6 +639,7 @@ jobs: needs: ['preconditions', 'pulsar-test-latest-version-image'] if: ${{ needs.preconditions.outputs.docs_only != 'true' }} env: + JOB_NAME: CI - System - ${{ matrix.name }} PULSAR_TEST_IMAGE_NAME: apachepulsar/pulsar-test-latest-version:latest strategy: fail-fast: false @@ -639,6 +676,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -732,6 +774,7 @@ jobs: needs: [ 'preconditions', 'pulsar-test-latest-version-image' ] if: ${{ needs.preconditions.outputs.docs_only != 'true' }} env: + JOB_NAME: CI Flaky - System - ${{ matrix.name }} PULSAR_TEST_IMAGE_NAME: apachepulsar/pulsar-test-latest-version:latest strategy: fail-fast: false @@ -751,6 +794,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} @@ -854,6 +902,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Install gh-actions-artifact-client.js uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master @@ -874,6 +927,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Cache Maven dependencies uses: actions/cache@v3 with: @@ -906,6 +964,11 @@ jobs: - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm + - name: Configure Gradle Enterprise + uses: ./.github/actions/gradle-enterprise + with: + token: ${{ secrets.GE_ACCESS_TOKEN }} + - name: Setup ssh access to build runner VM # ssh access is enabled for builds in own forks if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }} diff --git a/.gitignore b/.gitignore index 2759cf054f57e..c584baaa0a0b8 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,9 @@ examples/flink/src/main/java/org/apache/flink/avro/generated pulsar-flink/src/test/java/org/apache/flink/avro/generated pulsar-client/src/test/java/org/apache/pulsar/client/avro/generated /build/ + +test-reports/ + +# Gradle Enterprise +.mvn/.gradle-enterprise/ +.mvn/extensions.xml diff --git a/.mvn/ge-extensions.xml b/.mvn/ge-extensions.xml new file mode 100644 index 0000000000000..5852f0f5baec2 --- /dev/null +++ b/.mvn/ge-extensions.xml @@ -0,0 +1,34 @@ + + + + + com.gradle + gradle-enterprise-maven-extension + 1.16.1 + + + com.gradle + common-custom-user-data-maven-extension + 1.11.1 + + diff --git a/.mvn/gradle-enterprise-custom-user-data.groovy b/.mvn/gradle-enterprise-custom-user-data.groovy new file mode 100644 index 0000000000000..becb3b0149edc --- /dev/null +++ b/.mvn/gradle-enterprise-custom-user-data.groovy @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Add Maven command line arguments +def mavenCommand = '' +if (System.env.MAVEN_CMD_LINE_ARGS) { + mavenCommand = "mvn ${System.env.MAVEN_CMD_LINE_ARGS}".toString() + buildScan.value('Maven command line', mavenCommand) +} +if (System.env.GITHUB_ACTIONS) { + if (session.goals.size() == 1 && session.goals[0] == 'initialize') { + // omit publishing build scan when the only goal is "initialize" + buildScan.publishOnDemand() + } else { + def jobName = System.env.JOB_NAME ?: System.env.GITHUB_JOB + buildScan.value('GitHub Actions Job name', jobName) + buildScan.value('GitHub Actions Event name', System.env.GITHUB_EVENT_NAME) + buildScan.value('GitHub Ref name', System.env.GITHUB_REF_NAME) + buildScan.value('GitHub Actor', System.env.GITHUB_ACTOR) + buildScan.link('GitHub Repository', "https://github.com/" + System.env.GITHUB_REPOSITORY) + buildScan.link('GitHub Commit', "https://github.com/" + System.env.GITHUB_REPOSITORY + "/commits/" + System.env.GITHUB_SHA) + buildScan.buildScanPublished { publishedBuildScan -> + new File(System.env.GITHUB_STEP_SUMMARY).withWriterAppend { out -> + out.println("\n[Gradle build scan for '${mavenCommand}' in ${jobName}](${publishedBuildScan.buildScanUri})\n") + } + } + } +} \ No newline at end of file diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml new file mode 100644 index 0000000000000..3321acacbd131 --- /dev/null +++ b/.mvn/gradle-enterprise.xml @@ -0,0 +1,47 @@ + + + + + https://ge.apache.org + false + + + true + + true + true + + #{isFalse(env['GITHUB_ACTIONS'])} + ALWAYS + true + + #{{'0.0.0.0'}} + + + + + true + + + diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java index 21d6a7ed89a56..0a728d9839648 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java @@ -65,7 +65,6 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; import org.testng.annotations.Test; @Test(groups = "broker-api") @@ -93,14 +92,6 @@ public static Object[][] batchingModesAndValueEncodingType() { } - @DataProvider(name = "schemaValidationModes") - public static Object[][] schemaValidationModes() { - return new Object[][] { - { true }, - { false } - }; - } - @DataProvider(name = "topicDomain") public static Object[] topicDomain() { return new Object[] { "persistent://", "non-persistent://" }; @@ -108,8 +99,11 @@ public static Object[] topicDomain() { private final boolean schemaValidationEnforced; - @Factory(dataProvider = "schemaValidationModes") - public SimpleSchemaTest(boolean schemaValidationEnforced) { + public SimpleSchemaTest() { + this(false); + } + + protected SimpleSchemaTest(boolean schemaValidationEnforced) { this.schemaValidationEnforced = schemaValidationEnforced; } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaWithSchemaValidationEnforcedTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaWithSchemaValidationEnforcedTest.java new file mode 100644 index 0000000000000..0b3527e0b8e98 --- /dev/null +++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaWithSchemaValidationEnforcedTest.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.client.api; + +import org.testng.annotations.Test; + +@Test(groups = "broker-api") +public class SimpleSchemaWithSchemaValidationEnforcedTest extends SimpleSchemaTest { + public SimpleSchemaWithSchemaValidationEnforcedTest() { + super(true); + } +}