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.26
:project-tag: v1.0.27

ifdef::env-github[]
:tip-caption: :bulb:
Expand Down Expand Up @@ -38,6 +38,7 @@ Following inputs may be used as `step.with` keys:
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-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`.
| surround-connection-string-with-double-quotes | | false | If the connection string must be surrounded by double quotes: `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).
|===

Expand Down
10 changes: 8 additions & 2 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.26'
default: 'v1.0.27'
required: true
action:
description: 'The action to run (create*, delete, skip-testing).'
Expand All @@ -26,6 +26,10 @@ inputs:
description: 'The resulting connection string format (easy-connect*, tns).'
default: 'easy-connect'
required: false
surround-connection-string-with-double-quotes:
description: 'If the connection string must be surrounded by double quotes (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 @@ -79,5 +83,7 @@ runs:
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 }}"
--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 }}"

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.26</version>
<version>1.0.27</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.26";
public static final String VERSION="1.0.27";

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

private ConnectionStringFormat connectionStringFormat;

private boolean useDoubleQuotesForConnectionStringSuffix;

private String prefixList;
private String owner;
private String repository;
Expand Down Expand Up @@ -133,11 +135,13 @@ private void analyzeCommandLineParameters(final String[] args) {
users = args[++i];

if(users.length() > MAX_USERS_LENGTH) {
throw new TestPilotException(USER_PARAMETER_TOO_LONG, new IllegalArgumentException("Value for --user parameter is too long, maximum length: "+MAX_USERS_LENGTH));
throw new TestPilotException(USER_PARAMETER_TOO_LONG,
new IllegalArgumentException("Value for --user parameter is too long, maximum length: "+MAX_USERS_LENGTH));
}
}
else {
throw new TestPilotException(USER_MISSING_PARAMETER, new IllegalArgumentException("Missing value for --user parameter"));
throw new TestPilotException(USER_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --user parameter"));
}
break;

Expand Down Expand Up @@ -181,7 +185,20 @@ private void analyzeCommandLineParameters(final String[] args) {
}
}
else {
throw new TestPilotException(CONNECTION_STRING_FORMAT_MISSING_PARAMETER, new IllegalArgumentException("Missing value for --connection-string-format parameter"));
throw new TestPilotException(CONNECTION_STRING_FORMAT_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --connection-string-format parameter"));
}
break;

case "--surround-connection-string-with-double-quotes":
if (i + 1 < args.length) {
final String temp = args[++i];

useDoubleQuotesForConnectionStringSuffix = "true".equalsIgnoreCase(temp);
}
else {
throw new TestPilotException(SURROUND_CONNECTION_STRING_WITH_DOUBLE_QUOTES_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --surround-connection-string-with-double-quotes parameter"));
}
break;

Expand All @@ -194,7 +211,8 @@ private void analyzeCommandLineParameters(final String[] args) {
prefixList = args[++i];
}
else {
throw new TestPilotException(PREFIX_LIST_MISSING_PARAMETER, new IllegalArgumentException("Missing value for --prefix-list parameter"));
throw new TestPilotException(PREFIX_LIST_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --prefix-list parameter"));
}
break;

Expand All @@ -203,7 +221,8 @@ private void analyzeCommandLineParameters(final String[] args) {
owner = args[++i];
}
else {
throw new TestPilotException(OWNER_MISSING_PARAMETER, new IllegalArgumentException("Missing value for --owner parameter"));
throw new TestPilotException(OWNER_MISSING_PARAMETER,
new IllegalArgumentException("Missing value for --owner parameter"));
}
break;

Expand Down Expand Up @@ -240,12 +259,13 @@ private void displayUsage() {
Action:
--create: to provision the requested Oracle Cloud Infrastructure service to test
Options:
--oci-service <value> OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-26ai, base-database-service-26airac)
--oci-service <value> OCI service type (autonomous-transaction-processing-serverless-26ai, autonomous-transaction-processing-serverless-19c, base-database-service-26ai, base-database-service-26ai-rac, base-database-service-19c, base-database-service-21c)
--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)
--delete: to de-provision the Oracle Cloud Infrastructure service
Options:
--oci-service <value> OCI service type (autonomous-transaction-processing-serverless, base-database-service-19c, base-database-service-21c, base-database-service-26ai, base-database-service-26airac)
--oci-service <value> OCI service type (autonomous-transaction-processing-serverless-26ai, autonomous-transaction-processing-serverless-19c, base-database-service-26ai, base-database-service-26ai-rac, base-database-service-19c, base-database-service-21c)
--user <user> user name to be used (if several, then comma separated list without any space)
--skip-testing
Options:
Expand Down Expand Up @@ -438,14 +458,25 @@ private void writeDatabaseInformationToGitHubOutput(Database database, String co
if (githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
System.out.printf("::add-mask::%s%n", database.getPassword());
out.printf("""
if(useDoubleQuotesForConnectionStringSuffix){
out.printf("""
database_host=%s
database_service=%s
database_password=%s
database_version=%s
connection_string_suffix="%s"%n""",
database.getHost(), database.getService(), database.getPassword(), database.getVersion(),
connectionString);
database.getHost(), database.getService(), database.getPassword(), database.getVersion(),
connectionString);
} else {
out.printf("""
database_host=%s
database_service=%s
database_password=%s
database_version=%s
connection_string_suffix=%s%n""",
database.getHost(), database.getService(), database.getPassword(), database.getVersion(),
connectionString);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class TestPilotException extends RuntimeException {
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;
public static final int SURROUND_CONNECTION_STRING_WITH_DOUBLE_QUOTES_MISSING_PARAMETER = 15;
public static final int SKIP_TESTING_MISSING_PREFIX_LIST = 16;
public static final int SKIP_TESTING_WRONG_URI = 17;
public static final int SKIP_TESTING_WRONG_REST_CALL = 18;
Expand Down
Loading