diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 442c46f96a72..d1260dde601e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,39 +142,30 @@ jobs: - name: Omit produced artifacts from build cache run: ./ci/before-cache.sh - # Job for builds on Atlas (Oracle) infrastructure. + # Job for builds on Oracle TP infrastructure. # This is untrusted, even for pushes, see below. - atlas: + otp: permissions: contents: read name: GraalVM 21 - ${{matrix.rdbms}} - # runs-on: ubuntu-latest - runs-on: [ self-hosted, Linux, X64, OCI ] + runs-on: [ self-hosted, Linux, X64, OracleTestPilot ] strategy: fail-fast: false matrix: include: - - rdbms: oracle_atps - - rdbms: oracle_db19c - - rdbms: oracle_db21c - - rdbms: oracle_db23c + - rdbms: autonomous-transaction-processing-serverless + - rdbms: base-database-service-19c + - rdbms: base-database-service-21c + - rdbms: base-database-service-23ai steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - name: Reclaim disk space and sanitize user home - run: .github/ci-prerequisites-atlas.sh - - name: Start database - env: - RDBMS: ${{ matrix.rdbms }} - RUNID: ${{ github.run_number }} - run: ci/database-start.sh - name: Set up Java 21 uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1.2.8 with: distribution: 'graalvm' java-version: '21' - - name: Generate cache key id: cache-key run: | @@ -205,7 +196,7 @@ jobs: ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}- - name: Restore Maven/Gradle Dependency/Dist Caches uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - # if it a pull request, we restore the cache but we don't save it + # if it is a pull request, we restore the cache but we don't save it if: github.event_name == 'pull_request' with: path: | @@ -218,17 +209,35 @@ jobs: ${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}- ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}- + - id: create_database + uses: loiclefevre/test@03ce1d1ee2313b45249e7bf6b84dc0f4333cdd77 # v1.0.18 + with: + oci-service: ${{ matrix.rdbms }} + action: create + user: hibernate_orm_test_1,hibernate_orm_test_2,hibernate_orm_test_3,hibernate_orm_test_4 + - name: Run build script env: RDBMS: ${{ matrix.rdbms }} RUNID: ${{ github.run_number }} - # These runners have no HOME variable set by default, we need to explicitly set it to make the build work - HOME: /root + TESTPILOT_CONNECTION_STRING_SUFFIX: ${{ steps.create_database.outputs.connection_string_suffix }} + TESTPILOT_PASSWORD: ${{ steps.create_database.outputs.database_password }} + API_HOST: "" + TESTPILOT_CLIENT_ID: "" + TESTPILOT_TOKEN: "" # Needed for TFO (TCP fast open) - LD_PRELOAD: /home/opc/libtfojdbc1.so - LD_LIBRARY_PATH: /home/opc + LD_PRELOAD: /home/ubuntu/libtfojdbc1.so + LD_LIBRARY_PATH: /home/ubuntu run: ./ci/build-github.sh shell: bash + + - uses: loiclefevre/test@03ce1d1ee2313b45249e7bf6b84dc0f4333cdd77 # v1.0.18 + if: always() + with: + oci-service: ${{ matrix.rdbms }} + action: delete + user: hibernate_orm_test_1,hibernate_orm_test_2,hibernate_orm_test_3,hibernate_orm_test_4 + # Upload build scan data. # The actual publishing must be done in a separate job (see ci-report.yml). # We don't write to the remote cache as that would be unsafe. diff --git a/ci/build.sh b/ci/build.sh index caa70a93275d..3e9e54553baf 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -21,43 +21,41 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_13" ]; then elif [ "$RDBMS" == "oracle" ]; then goal="-Pdb=oracle_ci" elif [ "$RDBMS" == "oracle_xe" ] || [ "$RDBMS" == "oracle_21" ]; then - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_xe_ci" elif [ "$RDBMS" == "oracle_atps_tls" ]; then echo "Managing Oracle Autonomous Database..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=autonomous&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_autonomous_tls -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_atps" ]; then echo "Managing Oracle Autonomous Database..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=autonomous2&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_autonomous -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db19c" ]; then echo "Managing Oracle Database 19c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db19c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db19c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db21c" ]; then echo "Managing Oracle Database 21c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db21c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db21c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db23c" ]; then echo "Managing Oracle Database 23c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db23c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db23c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" +# OTP +elif [ "$RDBMS" == "autonomous-transaction-processing-serverless" ] || [ "$RDBMS" == "base-database-service-19c" ] || [ "$RDBMS" == "base-database-service-21c" ] || [ "$RDBMS" == "base-database-service-23ai" ]; then + echo "Managing OTP Database..." + goal="-Pdb=oracle_test_pilot_database -DrunID=$RUNID -DdbPassword=$TESTPILOT_PASSWORD -DdbConnectionStringSuffix=$TESTPILOT_CONNECTION_STRING_SUFFIX" elif [ "$RDBMS" == "db2" ] || [ "$RDBMS" == "db2_11_5" ]; then goal="-Pdb=db2_ci" elif [ "$RDBMS" == "mssql" ] || [ "$RDBMS" == "mssql_2017" ]; then diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index 646720bd52cf..c414ba9094b0 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -48,6 +48,7 @@ tasks.test { 'mysql_ci', 'oracle', 'oracle_ci', + 'oracle_test_pilot_database', 'oracle_xe_ci', 'mssql', 'mssql_ci' diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/jdbc/GradleParallelTestingResolver.java b/hibernate-testing/src/main/java/org/hibernate/testing/jdbc/GradleParallelTestingResolver.java index cd34646ff773..8cb96318afa5 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/jdbc/GradleParallelTestingResolver.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/jdbc/GradleParallelTestingResolver.java @@ -95,10 +95,16 @@ public static String resolveUsername(String username) { * @return an integer between 1 and {@link #GRADLE_MAXIMUM_PARALLEL_FORKS} system property (inclusive) */ private static int getRunningID() { - // enable parallelization of up to GRADLE_MAXIMUM_PARALLEL_FORKS - final Integer maxParallelForks = Integer.valueOf( System.getProperty( GRADLE_MAXIMUM_PARALLEL_FORKS, "1" ) ); - // Note that the worker ids are strictly monotonic - final Integer worker = Integer.valueOf( System.getProperty( GRADLE_WORKER_ID, "1" ) ); - return (worker % maxParallelForks) + 1; + try { + // enable parallelization of up to GRADLE_MAXIMUM_PARALLEL_FORKS + final Integer maxParallelForks = Integer.valueOf( + System.getProperty( GRADLE_MAXIMUM_PARALLEL_FORKS, "1" ) ); + // Note that the worker ids are strictly monotonic + final Integer worker = Integer.valueOf( System.getProperty( GRADLE_WORKER_ID, "1" ) ); + return (worker % maxParallelForks) + 1; + } + catch(NumberFormatException nfe) { + return 1; + } } } diff --git a/local-build-plugins/src/main/groovy/local.databases.gradle b/local-build-plugins/src/main/groovy/local.databases.gradle index 62b17a0153fa..df861163c014 100644 --- a/local-build-plugins/src/main/groovy/local.databases.gradle +++ b/local-build-plugins/src/main/groovy/local.databases.gradle @@ -9,6 +9,8 @@ ext { db = project.getProperty('db') dbHost = System.getProperty( 'dbHost', 'localhost' ) dbService = System.getProperty( 'dbService', '' ) + dbPassword = System.getProperty( 'dbPassword', '' ).replace('"', '') + dbConnectionStringSuffix = System.getProperty( 'dbConnectionStringSuffix', '' ).replace('"', '') runID = System.getProperty( 'runID', '' ) dbBundle = [ @@ -288,6 +290,15 @@ ext { // 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', 'connection.init_sql' : '' ], + oracle_test_pilot_database: [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_$worker_' + runID, + 'jdbc.pass' : dbPassword, + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbConnectionStringSuffix + '?oracle.jdbc.enableQueryResultCache=false', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', + 'connection.init_sql' : '' + ], mssql : [ 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',