Skip to content

Commit 156b91b

Browse files
committed
HHH-19690 - Migrate Atlas to OTP
1 parent 41b3177 commit 156b91b

File tree

5 files changed

+57
-32
lines changed

5 files changed

+57
-32
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,39 +142,30 @@ jobs:
142142
- name: Omit produced artifacts from build cache
143143
run: ./ci/before-cache.sh
144144

145-
# Job for builds on Atlas (Oracle) infrastructure.
145+
# Job for builds on Oracle TP infrastructure.
146146
# This is untrusted, even for pushes, see below.
147-
atlas:
147+
otp:
148148
permissions:
149149
contents: read
150150
name: GraalVM 21 - ${{matrix.rdbms}}
151-
# runs-on: ubuntu-latest
152-
runs-on: [ self-hosted, Linux, X64, OCI ]
151+
runs-on: [ self-hosted, Linux, X64, OracleTestPilot ]
153152
strategy:
154153
fail-fast: false
155154
matrix:
156155
include:
157-
- rdbms: oracle_atps
158-
- rdbms: oracle_db19c
159-
- rdbms: oracle_db21c
160-
- rdbms: oracle_db23c
156+
- rdbms: autonomous-transaction-processing-serverless
157+
- rdbms: base-database-service-19c
158+
- rdbms: base-database-service-21c
159+
- rdbms: base-database-service-23ai
161160
steps:
162161
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
163162
with:
164163
persist-credentials: false
165-
- name: Reclaim disk space and sanitize user home
166-
run: .github/ci-prerequisites-atlas.sh
167-
- name: Start database
168-
env:
169-
RDBMS: ${{ matrix.rdbms }}
170-
RUNID: ${{ github.run_number }}
171-
run: ci/database-start.sh
172164
- name: Set up Java 21
173165
uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1.2.8
174166
with:
175167
distribution: 'graalvm'
176168
java-version: '21'
177-
178169
- name: Generate cache key
179170
id: cache-key
180171
run: |
@@ -205,7 +196,7 @@ jobs:
205196
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
206197
- name: Restore Maven/Gradle Dependency/Dist Caches
207198
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
208-
# if it a pull request, we restore the cache but we don't save it
199+
# if it is a pull request, we restore the cache but we don't save it
209200
if: github.event_name == 'pull_request'
210201
with:
211202
path: |
@@ -218,17 +209,35 @@ jobs:
218209
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
219210
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
220211
212+
- id: create_database
213+
uses: loiclefevre/test@03ce1d1ee2313b45249e7bf6b84dc0f4333cdd77 # v1.0.18
214+
with:
215+
oci-service: ${{ matrix.rdbms }}
216+
action: create
217+
user: hibernate_orm_test_1,hibernate_orm_test_2,hibernate_orm_test_3,hibernate_orm_test_4
218+
221219
- name: Run build script
222220
env:
223221
RDBMS: ${{ matrix.rdbms }}
224222
RUNID: ${{ github.run_number }}
225-
# These runners have no HOME variable set by default, we need to explicitly set it to make the build work
226-
HOME: /root
223+
TESTPILOT_CONNECTION_STRING_SUFFIX: ${{ steps.create_database.outputs.connection_string_suffix }}
224+
TESTPILOT_PASSWORD: ${{ steps.create_database.outputs.database_password }}
225+
API_HOST: ""
226+
TESTPILOT_CLIENT_ID: ""
227+
TESTPILOT_TOKEN: ""
227228
# Needed for TFO (TCP fast open)
228-
LD_PRELOAD: /home/opc/libtfojdbc1.so
229-
LD_LIBRARY_PATH: /home/opc
229+
LD_PRELOAD: /home/ubuntu/libtfojdbc1.so
230+
LD_LIBRARY_PATH: /home/ubuntu
230231
run: ./ci/build-github.sh
231232
shell: bash
233+
234+
- uses: loiclefevre/test@03ce1d1ee2313b45249e7bf6b84dc0f4333cdd77 # v1.0.18
235+
if: always()
236+
with:
237+
oci-service: ${{ matrix.rdbms }}
238+
action: delete
239+
user: hibernate_orm_test_1,hibernate_orm_test_2,hibernate_orm_test_3,hibernate_orm_test_4
240+
232241
# Upload build scan data.
233242
# The actual publishing must be done in a separate job (see ci-report.yml).
234243
# We don't write to the remote cache as that would be unsafe.

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-spatial/hibernate-spatial.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ tasks.test {
4848
'mysql_ci',
4949
'oracle',
5050
'oracle_ci',
51+
'oracle_test_pilot_database',
5152
'oracle_xe_ci',
5253
'mssql',
5354
'mssql_ci'

hibernate-testing/src/main/java/org/hibernate/testing/jdbc/GradleParallelTestingResolver.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,16 @@ public static String resolveUsername(String username) {
9595
* @return an integer between 1 and {@link #GRADLE_MAXIMUM_PARALLEL_FORKS} system property (inclusive)
9696
*/
9797
private static int getRunningID() {
98-
// enable parallelization of up to GRADLE_MAXIMUM_PARALLEL_FORKS
99-
final Integer maxParallelForks = Integer.valueOf( System.getProperty( GRADLE_MAXIMUM_PARALLEL_FORKS, "1" ) );
100-
// Note that the worker ids are strictly monotonic
101-
final Integer worker = Integer.valueOf( System.getProperty( GRADLE_WORKER_ID, "1" ) );
102-
return (worker % maxParallelForks) + 1;
98+
try {
99+
// enable parallelization of up to GRADLE_MAXIMUM_PARALLEL_FORKS
100+
final Integer maxParallelForks = Integer.valueOf(
101+
System.getProperty( GRADLE_MAXIMUM_PARALLEL_FORKS, "1" ) );
102+
// Note that the worker ids are strictly monotonic
103+
final Integer worker = Integer.valueOf( System.getProperty( GRADLE_WORKER_ID, "1" ) );
104+
return (worker % maxParallelForks) + 1;
105+
}
106+
catch(NumberFormatException nfe) {
107+
return 1;
108+
}
103109
}
104110
}

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_$worker_' + 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)