diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 729ccf7..5aa88a3 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -37,7 +37,7 @@ jobs: - uses: graalvm/setup-graalvm@v1 with: - java-version: '23' + java-version: '25' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} # cache: 'maven' diff --git a/README.adoc b/README.adoc index 9fa33d1..8c931e9 100644 --- a/README.adoc +++ b/README.adoc @@ -2,7 +2,7 @@ :linkattrs: :project-owner: oracle-actions :project-name: setup-testpilot -:project-tag: v1.0.23 +:project-tag: v1.0.24 ifdef::env-github[] :tip-caption: :bulb: @@ -37,6 +37,7 @@ Following inputs may be used as `step.with` keys: | 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`. | 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 51f01da..f899b4c 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ branding: inputs: version: description: 'The version to use.' - default: 'v1.0.23' + default: 'v1.0.24' required: true action: description: 'The action to run (create*, delete, skip-testing).' @@ -22,6 +22,10 @@ inputs: user: description: '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.' required: false + connection-string-format: + description: 'The resulting connection string format (easy-connect*, tns).' + default: 'easy-connect' + required: false prefix_list: description: 'A comma separated list of file(s) or folder(s) that if changed should not trigger any test (example: folder containing documentation).' required: false @@ -74,5 +78,5 @@ runs: RUNID: ${{ github.run_number }} run: | ${GITHUB_ACTION_PATH}/setup-testpilot --${{ inputs.action }} \ - --user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" + --user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" --connection-string-format "${{ inputs.connection-string-format }}" diff --git a/pom.xml b/pom.xml index c834692..3293b3f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,17 +6,17 @@ com.oracle.testpilot testpilot-services - 1.0.23 + 1.0.24 Oracle Test Pilot actions - Actions offered by Oracle Test Pilot. + Actions provided by Oracle Test Pilot. UTF-8 5.8.1 3.8.1 - 23 - 23 - 23 + 25 + 25 + 25 VERBOSE 0.10.3 setup-testpilot @@ -81,7 +81,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.15.0 ${maven.compiler.source} ${maven.compiler.source} diff --git a/src/main/java/com/oracle/testpilot/Main.java b/src/main/java/com/oracle/testpilot/Main.java index 59ad9ff..2c112f0 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.23"; + public static final String VERSION="1.0.24"; public static void main(final String[] args) { int exitStatus = 0; @@ -53,7 +53,7 @@ public static void main(final String[] args) { } //System.out.println("Error: " + te.getMessage()); - te.printStackTrace(); + te.printStackTrace(System.err); } System.exit(exitStatus); diff --git a/src/main/java/com/oracle/testpilot/Session.java b/src/main/java/com/oracle/testpilot/Session.java index 9d223ed..74e2455 100644 --- a/src/main/java/com/oracle/testpilot/Session.java +++ b/src/main/java/com/oracle/testpilot/Session.java @@ -9,13 +9,7 @@ import com.oracle.testpilot.exception.TestPilotException; import com.oracle.testpilot.json.JSON; import com.oracle.testpilot.json.JSONArray; -import com.oracle.testpilot.model.Action; -import com.oracle.testpilot.model.Database; -import com.oracle.testpilot.model.GitHubCommittedFiles; -import com.oracle.testpilot.model.GitHubFilename; -import com.oracle.testpilot.model.GitHubPullRequestCommits; -import com.oracle.testpilot.model.OAuthToken; -import com.oracle.testpilot.model.TechnologyType; +import com.oracle.testpilot.model.*; import java.io.BufferedOutputStream; import java.io.FileNotFoundException; @@ -61,6 +55,8 @@ public class Session { private String users; private String technologyType; + private ConnectionStringFormat connectionStringFormat; + private String prefixList; private String owner; private String repository; @@ -165,6 +161,21 @@ private void analyzeCommandLineParameters(final String[] args) { } break; + case "--connection-string-format": + if (i + 1 < args.length) { + final String temp = args[++i]; + + if("tns".equalsIgnoreCase(temp)) { + connectionStringFormat = ConnectionStringFormat.TNS; + } else { + connectionStringFormat = ConnectionStringFormat.EASY_CONNECT; + } + } + else { + throw new TestPilotException(CONNECTION_STRING_FORMAT_MISSING_PARAMETER, new IllegalArgumentException("Missing value for --connection-string-format parameter")); + } + break; + case "--skip-testing": action = SKIP_TESTING; break; @@ -216,15 +227,16 @@ private void analyzeCommandLineParameters(final String[] args) { private void displayUsage() { System.out.println(""" Usage: setup-testpilot - + Action: --create: to provision the requested Oracle Cloud Infrastructure service to test Options: - --oci-service OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-23ai) + --oci-service OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-26ai) --user user name to be used (if several, then comma separated list without any space) + --connection-string-format requested connection string format (easy-connect*, or tns) --delete: to de-provision the Oracle Cloud Infrastructure service Options: - --oci-service OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-23ai) + --oci-service OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-26ai) --user user name to be used (if several, then comma separated list without any space) --skip-testing Options: @@ -310,7 +322,10 @@ runID, type, buildUserList(users,true)) Database database = new JSON<>(Database.class).parse(jsonInformation); database = new JSON<>(Database.class).parse(database.getDatabase()); - final String connectionString = String.format("(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcps)(port=1521)(host=%s.oraclecloud.com))(connect_data=(USE_TCP_FAST_OPEN=ON)(service_name=%s_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))", database.getHost(), database.getService()); + final String connectionString = connectionStringFormat == ConnectionStringFormat.TNS ? + String.format("(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcps)(port=1521)(host=%s.oraclecloud.com))(connect_data=(USE_TCP_FAST_OPEN=ON)(service_name=%s_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))", database.getHost(), database.getService()) + : + String.format("tcps://%s.oraclecloud.com:1521/%s_tp.adb.oraclecloud.com?retry_count=5&retry_delay=1&oracle.net.useTcpFastOpen=true&ssl_server_dn_match=false", database.getHost(), database.getService()); writeDatabaseInformationToGitHubOutput(database, connectionString); } @@ -322,7 +337,10 @@ runID, type, buildUserList(users,true)) Database database = new JSON<>(Database.class).parse(jsonInformation); database = new JSON<>(Database.class).parse(database.getDatabase()); - final String connectionString = String.format("%s:1521/%s", database.getHost(), database.getService()); + 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("%s:1521/%s", database.getHost(), database.getService()); writeDatabaseInformationToGitHubOutput(database, connectionString); } @@ -520,7 +538,7 @@ private String buildUserList(final String users, boolean create) { return sb.toString(); } - private String getInternalTechnologyType(String technologyType) { + private String getInternalTechnologyType(final String technologyType) { return switch (technologyType) { case "autonomous-transaction-processing-serverless-19c" -> TechnologyType.AUTONOMOUS19C; case "autonomous-transaction-processing-serverless", "autonomous-transaction-processing-serverless-26ai" -> TechnologyType.AUTONOMOUS26AI; @@ -528,7 +546,7 @@ private String getInternalTechnologyType(String technologyType) { case "base-database-service-21c" -> TechnologyType.DB21C; case "base-database-service-23ai" -> TechnologyType.DB23AI; case "base-database-service-26ai" -> TechnologyType.DB26AI; - default -> null; + default -> throw new TestPilotException(CREATE_DATABASE_MISSING_DB_TYPE); }; } diff --git a/src/main/java/com/oracle/testpilot/exception/TestPilotException.java b/src/main/java/com/oracle/testpilot/exception/TestPilotException.java index 182f828..96e158d 100644 --- a/src/main/java/com/oracle/testpilot/exception/TestPilotException.java +++ b/src/main/java/com/oracle/testpilot/exception/TestPilotException.java @@ -21,7 +21,7 @@ public class TestPilotException extends RuntimeException { public static final int RETRIEVE_OAUTH2_TOKEN = 8; public static final int TOO_MANY_USERS_PROVIDED = 9; public static final int CREATE_DATABASE_MISSING_USER_NAME = 10; - public static final int CREATE_DATABASE_MISSING_PASSWORD = 11; + public static final int CONNECTION_STRING_FORMAT_MISSING_PARAMETER = 11; public static final int CREATE_DATABASE_MISSING_DB_TYPE = 12; public static final int SKIP_TESTING_MISSING_OWNER = 13; public static final int SKIP_TESTING_MISSING_REPOSITORY = 14; diff --git a/src/main/java/com/oracle/testpilot/model/ConnectionStringFormat.java b/src/main/java/com/oracle/testpilot/model/ConnectionStringFormat.java new file mode 100644 index 0000000..fe0523a --- /dev/null +++ b/src/main/java/com/oracle/testpilot/model/ConnectionStringFormat.java @@ -0,0 +1,16 @@ +/* + ** Oracle Test Pilot + ** + ** Copyright (c) 2025-2026 Oracle + ** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ +package com.oracle.testpilot.model; + +/** + * @author LLEFEVRE + * @since 1.0.24 + */ +public enum ConnectionStringFormat { + EASY_CONNECT, + TNS +}