Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:linkattrs:
:project-owner: oracle-actions
:project-name: setup-testpilot
:project-tag: v1.0.25
:project-tag: v1.0.26

ifdef::env-github[]
:tip-caption: :bulb:
Expand Down Expand Up @@ -35,7 +35,7 @@ Following inputs may be used as `step.with` keys:
| Name | Required | Default | Description
| action | Yes | create | A valid action among: `create`, `delete`, `skip-testing`.
| oci-service | | autonomous-transaction-processing-serverless-26ai | A valid Oracle Cloud Infrastructure service to be tested.
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`.
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`.
| 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.
| connection-string-format | | easy-connect | The resulting connection string format: `easy-connect` or `tns`.
| prefix_list | | | A comma separated list of file(s) or folder(s) that if changed should not trigger any test (example: folder containing documentation).
Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ branding:
inputs:
version:
description: 'The version to use.'
default: 'v1.0.25'
default: 'v1.0.26'
required: true
action:
description: 'The action to run (create*, delete, skip-testing).'
Expand Down Expand Up @@ -76,6 +76,7 @@ runs:
shell: bash -leo pipefail {0}
env:
RUNID: ${{ github.run_number }}
JOBID: ${{ job.check_run_id }}
run: |
${GITHUB_ACTION_PATH}/setup-testpilot --${{ inputs.action }} \
--user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" --connection-string-format "${{ inputs.connection-string-format }}"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.oracle.testpilot</groupId>
<artifactId>testpilot-services</artifactId>
<version>1.0.25</version>
<version>1.0.26</version>
<name>Oracle Test Pilot actions</name>
<description>Actions provided by Oracle Test Pilot.</description>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/oracle/testpilot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Main {
System.setProperty("java.net.useSystemProxies", "false");
}

public static final String VERSION="1.0.25";
public static final String VERSION="1.0.26";

public static void main(final String[] args) {
int exitStatus = 0;
Expand Down
35 changes: 29 additions & 6 deletions src/main/java/com/oracle/testpilot/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Session {
private final String githubOutput;

private final String runID;
private final String jobID;
private final String apiHOST;
private String token;
private final String clientId;
Expand Down Expand Up @@ -81,6 +82,14 @@ public Session(final String[] args) {
// see https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context
runID = System.getenv("RUNID");
// ---------------------------------------------------------------------------------------------------------------------
// JOBID:
// The check run ID of the current job.
// env:
// JOBID: ${{ job.check_run_id }}
// job.check_run_id: The check run ID of the current job.
// see https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#job-context
jobID = System.getenv("JOBID");
// ---------------------------------------------------------------------------------------------------------------------
// API_HOST:
// URL targeting the private internal REST API endpoints to create and delete a user schema to be used to
// connect to the database to test the framework with. This environment variable is not exposed (read or write) to
Expand Down Expand Up @@ -296,8 +305,8 @@ private void create() {
"User-Agent", "setup-testpilot/" + Main.VERSION,
"Authorization", "Bearer " + token)
.POST(HttpRequest.BodyPublishers.ofString(
String.format("{\"runID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
runID, type, buildUserList(users,true))
String.format("{\"runID\":\"%s\",\"jobID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
runID, jobID, type, buildUserList(users,true))
))
.build();

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

final String connectionString = connectionStringFormat == ConnectionStringFormat.TNS ?
String.format("(description=(address=(protocol=tcp)(port=1521)(host=%s))(connect_data=(service_name=%s)))", database.getHost(), database.getService())
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())
:
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());

writeDatabaseInformationToGitHubOutput(database, connectionString);
}
break;
case TechnologyType.DB26AIRAC: {
Database database = new JSON<>(Database.class).parse(jsonInformation);
database = new JSON<>(Database.class).parse(database.getDatabase());

// using scan listener as the host
final String connectionString = connectionStringFormat == ConnectionStringFormat.TNS ?
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())
:
String.format("%s:1521/%s", database.getHost(), database.getService());
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());

writeDatabaseInformationToGitHubOutput(database, connectionString);
}
Expand Down Expand Up @@ -459,8 +481,8 @@ private void delete() {
"User-Agent", "setup-testpilot/" + Main.VERSION,
"Authorization", "Bearer " + token)
.POST(HttpRequest.BodyPublishers.ofString(
String.format("{\"runID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
runID, type, buildUserList(users,false))
String.format("{\"runID\":\"%s\",\"jobID\":\"%s\",\"type\":\"%s\",\"user\":[%s]}",
runID, jobID, type, buildUserList(users,false))
))
.build();

Expand Down Expand Up @@ -606,6 +628,7 @@ private String getInternalTechnologyType(final String technologyType) {
case "base-database-service-21c" -> TechnologyType.DB21C;
case "base-database-service-23ai" -> TechnologyType.DB23AI;
case "base-database-service-26ai" -> TechnologyType.DB26AI;
case "base-database-service-26ai-rac" -> TechnologyType.DB26AIRAC;
default -> throw new TestPilotException(CREATE_DATABASE_MISSING_DB_TYPE);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public class TechnologyType {
public static final String DB21C = "db21c";
public static final String DB23AI = "db23ai";
public static final String DB26AI = "db26ai";
public static final String DB26AIRAC = "db26airac";
}
Loading