diff --git a/README.adoc b/README.adoc index fece31e..c5af020 100644 --- a/README.adoc +++ b/README.adoc @@ -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: @@ -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). diff --git a/action.yml b/action.yml index 446ac51..831c1d8 100644 --- a/action.yml +++ b/action.yml @@ -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).' @@ -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 }}" diff --git a/pom.xml b/pom.xml index a7491bd..6713dbc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.oracle.testpilot testpilot-services - 1.0.25 + 1.0.26 Oracle Test Pilot actions Actions provided by Oracle Test Pilot. diff --git a/src/main/java/com/oracle/testpilot/Main.java b/src/main/java/com/oracle/testpilot/Main.java index 3292aa2..de84a16 100644 --- a/src/main/java/com/oracle/testpilot/Main.java +++ b/src/main/java/com/oracle/testpilot/Main.java @@ -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; diff --git a/src/main/java/com/oracle/testpilot/Session.java b/src/main/java/com/oracle/testpilot/Session.java index 50158d1..60c2816 100644 --- a/src/main/java/com/oracle/testpilot/Session.java +++ b/src/main/java/com/oracle/testpilot/Session.java @@ -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; @@ -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 @@ -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(); @@ -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); } @@ -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(); @@ -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); }; } diff --git a/src/main/java/com/oracle/testpilot/model/TechnologyType.java b/src/main/java/com/oracle/testpilot/model/TechnologyType.java index d63bebc..aa792b2 100644 --- a/src/main/java/com/oracle/testpilot/model/TechnologyType.java +++ b/src/main/java/com/oracle/testpilot/model/TechnologyType.java @@ -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"; }