Skip to content

Commit d57e423

Browse files
committed
HHH-19690 - Migrate Atlas to OTP
1 parent ceda032 commit d57e423

File tree

4 files changed

+135
-10
lines changed

4 files changed

+135
-10
lines changed

.github/workflows/ci.yml

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ jobs:
155155
matrix:
156156
include:
157157
- rdbms: oracle_atps
158-
- rdbms: oracle_db19c
159-
- rdbms: oracle_db21c
160-
- rdbms: oracle_db23c
158+
#- rdbms: oracle_db19c
159+
#- rdbms: oracle_db21c
160+
#- rdbms: oracle_db23c
161161
steps:
162162
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
163163
with:
@@ -249,6 +249,122 @@ jobs:
249249
- name: Omit produced artifacts from build cache
250250
run: ./ci/before-cache.sh
251251

252+
# Job for builds on Oracle TP infrastructure.
253+
# This is untrusted, even for pushes, see below.
254+
otp:
255+
permissions:
256+
contents: read
257+
name: GraalVM 21 - ${{matrix.rdbms}}
258+
runs-on: [ self-hosted, Linux, X64, OracleTestPilot ]
259+
strategy:
260+
fail-fast: false
261+
matrix:
262+
include:
263+
#- rdbms: autonomous-transaction-processing-serverless
264+
- rdbms: base-database-service-19c
265+
- rdbms: base-database-service-21c
266+
- rdbms: base-database-service-23ai
267+
steps:
268+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
269+
with:
270+
persist-credentials: false
271+
- name: Set up Java 21
272+
uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1.2.8
273+
with:
274+
distribution: 'graalvm'
275+
java-version: '21'
276+
- name: Generate cache key
277+
id: cache-key
278+
run: |
279+
CURRENT_BRANCH="${{ github.repository != 'hibernate/hibernate-orm' && 'fork' || github.base_ref || github.ref_name }}"
280+
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
281+
CURRENT_DAY=$(/bin/date -u "+%d")
282+
ROOT_CACHE_KEY="buildtool-cache-atlas"
283+
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
284+
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
285+
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
286+
- name: Cache Maven/Gradle Dependency/Dist Caches
287+
id: cache-maven
288+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
289+
# if it's not a pull request, we restore and save the cache
290+
if: github.event_name != 'pull_request'
291+
with:
292+
path: |
293+
~/.m2/repository/
294+
~/.m2/wrapper/
295+
~/.gradle/caches/modules-2
296+
~/.gradle/wrapper/
297+
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
298+
# The whole cache is dropped monthly to prevent unlimited growth.
299+
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
300+
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
301+
restore-keys: |
302+
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
303+
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
304+
- name: Restore Maven/Gradle Dependency/Dist Caches
305+
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
306+
# if it is a pull request, we restore the cache but we don't save it
307+
if: github.event_name == 'pull_request'
308+
with:
309+
path: |
310+
~/.m2/repository/
311+
~/.m2/wrapper/
312+
~/.gradle/caches/modules-2
313+
~/.gradle/wrapper/
314+
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
315+
restore-keys: |
316+
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
317+
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
318+
319+
- id: create_database
320+
uses: loiclefevre/[email protected]
321+
with:
322+
oci-service: ${{ matrix.rdbms }}
323+
action: create
324+
user: hibernate_orm_test
325+
326+
- name: Run build script
327+
env:
328+
RDBMS: ${{ matrix.rdbms }}
329+
RUNID: ${{ github.run_number }}
330+
TESTPILOT_CONNECTION_STRING_SUFFIX: ${{ steps.create_database.outputs.connection_string_suffix }}
331+
TESTPILOT_PASSWORD: ${{ steps.create_database.outputs.database_password }}
332+
API_HOST: ""
333+
TESTPILOT_CLIENT_ID: ""
334+
TESTPILOT_TOKEN: ""
335+
# Needed for TFO (TCP fast open)
336+
LD_PRELOAD: /home/ubuntu/libtfojdbc1.so
337+
LD_LIBRARY_PATH: /home/ubuntu
338+
run: ./ci/build-github.sh
339+
shell: bash
340+
341+
- uses: loiclefevre/[email protected]
342+
if: always()
343+
with:
344+
oci-service: ${{ matrix.rdbms }}
345+
action: delete
346+
user: hibernate_orm_test
347+
348+
# Upload build scan data.
349+
# The actual publishing must be done in a separate job (see ci-report.yml).
350+
# We don't write to the remote cache as that would be unsafe.
351+
# That's even on push, because we do not trust Atlas runners to hold secrets: they are shared infrastructure.
352+
- name: Upload GitHub Actions artifact for the Develocity build scan
353+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
354+
if: "${{ !cancelled() }}"
355+
with:
356+
name: build-scan-data-${{ matrix.rdbms }}
357+
path: ~/.gradle/build-scan-data
358+
- name: Upload test reports (if Gradle failed)
359+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
360+
if: failure()
361+
with:
362+
name: test-reports-java11-${{ matrix.rdbms }}
363+
path: |
364+
./**/target/reports/tests/
365+
- name: Omit produced artifacts from build cache
366+
run: ./ci/before-cache.sh
367+
252368
# Static code analysis check
253369
format_checks:
254370
permissions:

ci/build.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,41 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_13" ]; then
2121
elif [ "$RDBMS" == "oracle" ]; then
2222
goal="-Pdb=oracle_ci"
2323
elif [ "$RDBMS" == "oracle_xe" ] || [ "$RDBMS" == "oracle_21" ]; then
24-
# I have no idea why, but these tests don't seem to work on CI...
2524
goal="-Pdb=oracle_xe_ci"
2625
elif [ "$RDBMS" == "oracle_atps_tls" ]; then
2726
echo "Managing Oracle Autonomous Database..."
2827
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')
2928
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
3029
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
31-
# I have no idea why, but these tests don't seem to work on CI...
3230
goal="-Pdb=oracle_cloud_autonomous_tls -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
3331
elif [ "$RDBMS" == "oracle_atps" ]; then
3432
echo "Managing Oracle Autonomous Database..."
3533
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')
3634
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
3735
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
38-
# I have no idea why, but these tests don't seem to work on CI...
3936
goal="-Pdb=oracle_cloud_autonomous -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
4037
elif [ "$RDBMS" == "oracle_db19c" ]; then
4138
echo "Managing Oracle Database 19c..."
4239
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')
4340
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
4441
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
45-
# I have no idea why, but these tests don't seem to work on CI...
4642
goal="-Pdb=oracle_cloud_db19c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
4743
elif [ "$RDBMS" == "oracle_db21c" ]; then
4844
echo "Managing Oracle Database 21c..."
4945
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')
5046
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
5147
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
52-
# I have no idea why, but these tests don't seem to work on CI...
5348
goal="-Pdb=oracle_cloud_db21c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
5449
elif [ "$RDBMS" == "oracle_db23c" ]; then
5550
echo "Managing Oracle Database 23c..."
5651
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')
5752
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
5853
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
59-
# I have no idea why, but these tests don't seem to work on CI...
6054
goal="-Pdb=oracle_cloud_db23c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
55+
# OTP
56+
elif [ "$RDBMS" == "autonomous-transaction-processing-serverless" ] || [ "$RDBMS" == "base-database-service-19c" ] || [ "$RDBMS" == "base-database-service-21c" ] || [ "$RDBMS" == "base-database-service-23ai" ]; then
57+
echo "Managing OTP Database..."
58+
goal="-Pdb=oracle_test_pilot_database -DrunID=$RUNID -DdbPassword=$TESTPILOT_PASSWORD -DdbConnectionStringSuffix=$TESTPILOT_CONNECTION_STRING_SUFFIX"
6159
elif [ "$RDBMS" == "db2" ] || [ "$RDBMS" == "db2_11_5" ]; then
6260
goal="-Pdb=db2_ci"
6361
elif [ "$RDBMS" == "mssql" ] || [ "$RDBMS" == "mssql_2017" ]; then

hibernate-core/src/test/java/org/hibernate/orm/test/datasource/DataSourceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void test(EntityManagerFactoryScope scope) {
3636
scope.getEntityManagerFactory();
3737
LogInspectionHelper.clearAllListeners( ConnectionInfoLogger.INSTANCE );
3838
Dialect dialect = scope.getDialect();
39-
assertTrue( dialect instanceof OracleDialect od && od.isAutonomous()
39+
assertTrue( dialect instanceof OracleDialect
4040
|| dialect instanceof DB2Dialect
4141
|| dialect instanceof InformixDialect // Informix metadata does not include the URL
4242
|| listener.seen );

local-build-plugins/src/main/groovy/local.databases.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ext {
99
db = project.getProperty('db')
1010
dbHost = System.getProperty( 'dbHost', 'localhost' )
1111
dbService = System.getProperty( 'dbService', '' )
12+
dbPassword = System.getProperty( 'dbPassword', '' ).replace('"', '')
13+
dbConnectionStringSuffix = System.getProperty( 'dbConnectionStringSuffix', '' ).replace('"', '')
1214
runID = System.getProperty( 'runID', '' )
1315

1416
dbBundle = [
@@ -288,6 +290,15 @@ ext {
288290
// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource',
289291
'connection.init_sql' : ''
290292
],
293+
oracle_test_pilot_database: [
294+
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
295+
'jdbc.driver': 'oracle.jdbc.OracleDriver',
296+
'jdbc.user' : 'hibernate_orm_test_' + runID,
297+
'jdbc.pass' : dbPassword,
298+
'jdbc.url' : 'jdbc:oracle:thin:@' + dbConnectionStringSuffix + '?oracle.jdbc.enableQueryResultCache=false',
299+
'jdbc.datasource' : 'oracle.jdbc.OracleDriver',
300+
'connection.init_sql' : ''
301+
],
291302
mssql : [
292303
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect',
293304
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',

0 commit comments

Comments
 (0)