Skip to content

Commit 9c6c1a0

Browse files
authored
Merge pull request #9 from loiclefevre/5
7+8 - Add support for 26ai RAC database and provide JobID to Test Pilot infrastructure
2 parents 37676e7 + 5b624fe commit 9c6c1a0

6 files changed

Lines changed: 36 additions & 11 deletions

File tree

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:linkattrs:
33
:project-owner: oracle-actions
44
:project-name: setup-testpilot
5-
:project-tag: v1.0.25
5+
:project-tag: v1.0.26
66

77
ifdef::env-github[]
88
:tip-caption: :bulb:
@@ -35,7 +35,7 @@ Following inputs may be used as `step.with` keys:
3535
| Name | Required | Default | Description
3636
| action | Yes | create | A valid action among: `create`, `delete`, `skip-testing`.
3737
| oci-service | | autonomous-transaction-processing-serverless-26ai | A valid Oracle Cloud Infrastructure service to be tested.
38-
Valid OCI service are: `autonomous-transaction-processing-serverless-19c`, `autonomous-transaction-processing-serverless-26ai`, `base-database-service-19c`, `base-database-service-21c`, `base-database-service-23ai`, and `base-database-service-26ai`.
38+
Valid OCI service are: `autonomous-transaction-processing-serverless-19c`, `autonomous-transaction-processing-serverless-26ai`, `base-database-service-19c`, `base-database-service-21c`, `base-database-service-23ai`, `base-database-service-26ai`, and `base-database-service-26ai-rac`.
3939
| user | | | The database username to be used for database creation. If multiple users (up to 10) are required then enter a comma-separated list of usernames (no space). Limit usernames to 118 chars maximum. Accepted chars are: upper case letters, lower case letters, digits, colon, hyphen, underscore, and dot.
4040
| connection-string-format | | easy-connect | The resulting connection string format: `easy-connect` or `tns`.
4141
| prefix_list | | | A comma separated list of file(s) or folder(s) that if changed should not trigger any test (example: folder containing documentation).

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ branding:
99
inputs:
1010
version:
1111
description: 'The version to use.'
12-
default: 'v1.0.25'
12+
default: 'v1.0.26'
1313
required: true
1414
action:
1515
description: 'The action to run (create*, delete, skip-testing).'
@@ -76,6 +76,7 @@ runs:
7676
shell: bash -leo pipefail {0}
7777
env:
7878
RUNID: ${{ github.run_number }}
79+
JOBID: ${{ job.check_run_id }}
7980
run: |
8081
${GITHUB_ACTION_PATH}/setup-testpilot --${{ inputs.action }} \
8182
--user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" --connection-string-format "${{ inputs.connection-string-format }}"

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.oracle.testpilot</groupId>
88
<artifactId>testpilot-services</artifactId>
9-
<version>1.0.25</version>
9+
<version>1.0.26</version>
1010
<name>Oracle Test Pilot actions</name>
1111
<description>Actions provided by Oracle Test Pilot.</description>
1212

src/main/java/com/oracle/testpilot/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Main {
2323
System.setProperty("java.net.useSystemProxies", "false");
2424
}
2525

26-
public static final String VERSION="1.0.25";
26+
public static final String VERSION="1.0.26";
2727

2828
public static void main(final String[] args) {
2929
int exitStatus = 0;

src/main/java/com/oracle/testpilot/Session.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class Session {
4848
private final String githubOutput;
4949

5050
private final String runID;
51+
private final String jobID;
5152
private final String apiHOST;
5253
private String token;
5354
private final String clientId;
@@ -81,6 +82,14 @@ public Session(final String[] args) {
8182
// see https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context
8283
runID = System.getenv("RUNID");
8384
// ---------------------------------------------------------------------------------------------------------------------
85+
// JOBID:
86+
// The check run ID of the current job.
87+
// env:
88+
// JOBID: ${{ job.check_run_id }}
89+
// job.check_run_id: The check run ID of the current job.
90+
// see https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#job-context
91+
jobID = System.getenv("JOBID");
92+
// ---------------------------------------------------------------------------------------------------------------------
8493
// API_HOST:
8594
// URL targeting the private internal REST API endpoints to create and delete a user schema to be used to
8695
// connect to the database to test the framework with. This environment variable is not exposed (read or write) to
@@ -296,8 +305,8 @@ private void create() {
296305
"User-Agent", "setup-testpilot/" + Main.VERSION,
297306
"Authorization", "Bearer " + token)
298307
.POST(HttpRequest.BodyPublishers.ofString(
299-
String.format("{\"runID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
300-
runID, type, buildUserList(users,true))
308+
String.format("{\"runID\":\"%s\",\"jobID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
309+
runID, jobID, type, buildUserList(users,true))
301310
))
302311
.build();
303312

@@ -339,9 +348,22 @@ runID, type, buildUserList(users,true))
339348
database = new JSON<>(Database.class).parse(database.getDatabase());
340349

341350
final String connectionString = connectionStringFormat == ConnectionStringFormat.TNS ?
342-
String.format("(description=(address=(protocol=tcp)(port=1521)(host=%s))(connect_data=(service_name=%s)))", database.getHost(), database.getService())
351+
String.format("(description=(retry_count=3)(retry_delay=1)(address=(protocol=tcp)(port=1521)(host=%s))(connect_data=(service_name=%s)))", database.getHost(), database.getService())
352+
:
353+
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());
354+
355+
writeDatabaseInformationToGitHubOutput(database, connectionString);
356+
}
357+
break;
358+
case TechnologyType.DB26AIRAC: {
359+
Database database = new JSON<>(Database.class).parse(jsonInformation);
360+
database = new JSON<>(Database.class).parse(database.getDatabase());
361+
362+
// using scan listener as the host
363+
final String connectionString = connectionStringFormat == ConnectionStringFormat.TNS ?
364+
String.format("(description=(connect_timeout=5)(transport_connect_timeout=3)(retry_count=3)(retry_delay=1)(address_list=(load_balance=on)(address=(protocol=tcp)(host=%s)(port=1521)))(connect_data=(service_name=%s)))", database.getHost(), database.getService())
343365
:
344-
String.format("%s:1521/%s", database.getHost(), database.getService());
366+
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());
345367

346368
writeDatabaseInformationToGitHubOutput(database, connectionString);
347369
}
@@ -459,8 +481,8 @@ private void delete() {
459481
"User-Agent", "setup-testpilot/" + Main.VERSION,
460482
"Authorization", "Bearer " + token)
461483
.POST(HttpRequest.BodyPublishers.ofString(
462-
String.format("{\"runID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
463-
runID, type, buildUserList(users,false))
484+
String.format("{\"runID\":\"%s\",\"jobID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
485+
runID, jobID, type, buildUserList(users,false))
464486
))
465487
.build();
466488

@@ -606,6 +628,7 @@ private String getInternalTechnologyType(final String technologyType) {
606628
case "base-database-service-21c" -> TechnologyType.DB21C;
607629
case "base-database-service-23ai" -> TechnologyType.DB23AI;
608630
case "base-database-service-26ai" -> TechnologyType.DB26AI;
631+
case "base-database-service-26ai-rac" -> TechnologyType.DB26AIRAC;
609632
default -> throw new TestPilotException(CREATE_DATABASE_MISSING_DB_TYPE);
610633
};
611634
}

src/main/java/com/oracle/testpilot/model/TechnologyType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public class TechnologyType {
1717
public static final String DB21C = "db21c";
1818
public static final String DB23AI = "db23ai";
1919
public static final String DB26AI = "db26ai";
20+
public static final String DB26AIRAC = "db26airac";
2021
}

0 commit comments

Comments
 (0)