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
3 changes: 2 additions & 1 deletion 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.30
:project-tag: v1.0.31

ifdef::env-github[]
:tip-caption: :bulb:
Expand Down Expand Up @@ -40,6 +40,7 @@ Valid OCI service are: `autonomous-transaction-processing-serverless-19c`, `auto
| 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`.
| surround-connection-string-with-double-quotes | | false | If the connection string must be surrounded by double quotes: `true` or `false`.
| fully-qualified-names | | false | If the `database_host` and `database_service` output parameters must return a fully qualified hostname and service name (including the domain name): `true` or `false`.
| prefix_list | | | A comma separated list of file(s) or folder(s) that if changed should not trigger any test (example: folder containing documentation).
| github-token | | | A valid GitHub token.
| target-repository | | the repository where the action runs | To override the default repository used for registration token creation.
Expand Down
13 changes: 8 additions & 5 deletions 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.30'
default: 'v1.0.31'
required: true
action:
description: 'The action to run (create*, delete, skip-testing).'
Expand All @@ -30,6 +30,10 @@ inputs:
description: 'If the connection string must be surrounded by double quotes (false*, true).'
default: 'false'
required: false
fully-qualified-names:
description: 'If the `database_host` and `database_service` output parameters must return a fully qualified hostname and service name (including the domain name) (false*, true).'
default: 'false'
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
Expand Down Expand Up @@ -102,7 +106,8 @@ runs:
${GITHUB_ACTION_PATH}/setup-testpilot --create \
--user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" \
--connection-string-format "${{ inputs.connection-string-format }}" \
--surround-connection-string-with-double-quotes "${{ inputs.surround-connection-string-with-double-quotes }}"
--surround-connection-string-with-double-quotes "${{ inputs.surround-connection-string-with-double-quotes }}" \
--fully-qualified-names "${{ inputs.fully-qualified-names }}"

- name: 'Delete'
id: delete
Expand All @@ -113,9 +118,7 @@ runs:
JOBID: ${{ job.check_run_id }}
run: |
${GITHUB_ACTION_PATH}/setup-testpilot --delete \
--user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}" \
--connection-string-format "${{ inputs.connection-string-format }}" \
--surround-connection-string-with-double-quotes "${{ inputs.surround-connection-string-with-double-quotes }}"
--user "${{ inputs.user }}" --oci-service "${{ inputs.oci-service }}"

- name: 'Create registration token'
id: create_registration_token
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.30</version>
<version>1.0.31</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.30";
public static final String VERSION="1.0.31";

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

private boolean useDoubleQuotesForConnectionStringSuffix;
private boolean useFullyQualifiedNames;

private String prefixList;
private String owner;
Expand Down Expand Up @@ -214,6 +215,18 @@ private void analyzeCommandLineParameters(final String[] args) {
}
break;

case "--fully-qualified-names":
if (i + 1 < args.length) {
final String temp = args[++i];

useFullyQualifiedNames = "true".equalsIgnoreCase(temp);
}
else {
throw new TestPilotException(FULLY_QUALIFIED_NAMES_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --fully-qualified-names parameter"));
}
break;

case "--skip-testing":
action = SKIP_TESTING;
break;
Expand Down Expand Up @@ -285,6 +298,7 @@ private void displayUsage() {
--user <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)
--surround-connection-string-with-double-quotes tells if the connection string must be surrounded with double quotes (false*, or true)
--fully-qualified-names tells if the database_host and database_service output parameters must be fully qualified (including the domain name) (false*, or true)

--delete: to de-provision the Oracle Cloud Infrastructure service
Options:
Expand Down Expand Up @@ -522,7 +536,8 @@ runID, jobID, type, buildUserList(users,true, false))
:
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, buildUserList(users,true, true), "tcps", 1521);
writeDatabaseInformationToGitHubOutput(database, connectionString, buildUserList(users,true, true), "tcps", 1521,
database.getHost()+(useFullyQualifiedNames ?".oraclecloud.com":""), database.getService()+(useFullyQualifiedNames ?"_tp.adb.oraclecloud.com":""));
}
break;
case TechnologyType.DB19C:
Expand All @@ -536,7 +551,7 @@ runID, jobID, type, buildUserList(users,true, false))
:
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());

writeDatabaseInformationToGitHubOutput(database, connectionString, buildUserList(users,true, true), "tcp", 1521);
writeDatabaseInformationToGitHubOutput(database, connectionString, buildUserList(users,true, true), "tcp", 1521, database.getHost(), database.getService());
}
break;
case TechnologyType.DB26AIRAC: {
Expand All @@ -549,7 +564,7 @@ runID, jobID, type, buildUserList(users,true, false))
:
String.format("%s:1521/%s?retry_count=3&retry_delay=1", database.getHost(), database.getService());

writeDatabaseInformationToGitHubOutput(database, connectionString, buildUserList(users,true, true), "tcp", 1521);
writeDatabaseInformationToGitHubOutput(database, connectionString, buildUserList(users,true, true), "tcp", 1521, database.getHost(), database.getService());
}
break;
}
Expand Down Expand Up @@ -619,7 +634,7 @@ else if(response.statusCode() == 504) {
}
}

private void writeDatabaseInformationToGitHubOutput(Database database, String connectionString, String users, String protocol, int port) throws FileNotFoundException {
private void writeDatabaseInformationToGitHubOutput(Database database, String connectionString, String users, String protocol, int port, String hostname, String serviceName) throws FileNotFoundException {
if (githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
System.out.printf("::add-mask::%s%n", database.getPassword());
Expand All @@ -633,7 +648,7 @@ private void writeDatabaseInformationToGitHubOutput(Database database, String co
database_password=%s
database_version=%s
connection_string_suffix="%s"%n""",
protocol, database.getHost(), port, database.getService(), users, database.getPassword(), database.getVersion(),
protocol, hostname, port, serviceName, users, database.getPassword(), database.getVersion(),
connectionString);
} else {
out.printf("""
Expand All @@ -645,7 +660,7 @@ private void writeDatabaseInformationToGitHubOutput(Database database, String co
database_password=%s
database_version=%s
connection_string_suffix=%s%n""",
protocol, database.getHost(), port, database.getService(), users, database.getPassword(), database.getVersion(),
protocol, hostname, port, serviceName, users, database.getPassword(), database.getVersion(),
connectionString);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class TestPilotException extends RuntimeException {
public static final int WRONG_PROVIDE_REGISTRATION_TOKEN_REST_CALL = 41;
public static final int RETRIEVE_REGISTRATION_TOKEN = 42;
public static final int CREATE_REGISTRATION_TOKEN_REST_ENDPOINT_ISSUE = 43;
public static final int FULLY_QUALIFIED_NAMES_MISSING_PARAMETER = 44;

private final int errorCode;

Expand Down
Loading