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
2 changes: 1 addition & 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.24
:project-tag: v1.0.25

ifdef::env-github[]
:tip-caption: :bulb:
Expand Down
2 changes: 1 addition & 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.24'
default: 'v1.0.25'
required: true
action:
description: 'The action to run (create*, delete, skip-testing).'
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.24</version>
<version>1.0.25</version>
<name>Oracle Test Pilot actions</name>
<description>Actions provided by Oracle Test Pilot.</description>

Expand Down
2 changes: 1 addition & 1 deletion setup-testpilot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
if [ ! -f "${GITHUB_ACTION_PATH}"/setup-testpilot ]; then

echo "::group::🔽 Downloading setup-testpilot"
wget https://github.com/oracle-actions/setup-testpilot/releases/download/${VERSION}/setup-testpilot-linux-x86_64.tar.gz -O ${GITHUB_ACTION_PATH}/setup-testpilot-linux-x86_64.tar.gz -q
wget --continue --progress=dot:mega --tries=0 https://github.com/oracle-actions/setup-testpilot/releases/download/${VERSION}/setup-testpilot-linux-x86_64.tar.gz -O ${GITHUB_ACTION_PATH}/setup-testpilot-linux-x86_64.tar.gz -q
echo "::endgroup::"

echo "::group::📦 Unpacking setup-testpilot"
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.24";
public static final String VERSION="1.0.25";

public static void main(final String[] args) {
int exitStatus = 0;
Expand Down
92 changes: 76 additions & 16 deletions src/main/java/com/oracle/testpilot/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,27 +279,28 @@ private void create() {
try {
final String type = getInternalTechnologyType(technologyType);

setOAuth2Token();

final String uri = String.format("https://%s/ords/testpilot/resources/create", apiHOST);

final HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(uri))
.headers("Accept", "application/json",
"Content-Type", "application/json",
"Pragma", "no-cache",
"Cache-Control", "no-store",
"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))
))
.build();

boolean done = false;
int retryCount = 5;

do {
setOAuth2Token();

final HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(uri))
.headers("Accept", "application/json",
"Content-Type", "application/json",
"Pragma", "no-cache",
"Cache-Control", "no-store",
"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))
))
.build();

try (HttpClient client = HttpClient
.newBuilder()
.connectTimeout(Duration.ofSeconds(ONE_MINUTE_TIMEOUT))
Expand Down Expand Up @@ -357,7 +358,32 @@ else if(response.statusCode() == 429) {
// too many requests (rate limiting)
Thread.sleep(10 * 1000L);
}
else if(response.statusCode() == 504) {
// Gateway time-out (load balancer)
// retry 5 times with 1 minute time-out each time
retryCount--;
if(retryCount == 0) {
if(githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("create=ko");
}
}

throw new TestPilotException(CREATE_DATABASE_REST_ENDPOINT_ISSUE,
new IllegalStateException("HTTP/S status code: " + response.statusCode(),
new IllegalStateException(response.body())));
} else {
System.out.printf("Gateway time-out, retrying in 10 seconds...%n");
Thread.sleep(10 * 1000L);
}
}
else {
if(githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("create=ko");
}
}

throw new TestPilotException(CREATE_DATABASE_REST_ENDPOINT_ISSUE,
new IllegalStateException("HTTP/S status code: " + response.statusCode(),
new IllegalStateException(response.body())));
Expand All @@ -366,9 +392,23 @@ else if(response.statusCode() == 429) {
} while(!done);
}
catch (URISyntaxException e) {
if (githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("delete=ko");
}
catch(IOException ignored) {}
}

throw new TestPilotException(WRONG_MAIN_CONTROLLER_URI, e);
}
catch (IOException | InterruptedException e) {
if (githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("delete=ko");
}
catch(IOException ignored) {}
}

throw new TestPilotException(WRONG_MAIN_CONTROLLER_REST_CALL, e);
}
}
Expand Down Expand Up @@ -460,16 +500,36 @@ else if(response.statusCode() == 504) {
}
}
else {
if (githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("delete=ko");
}
}

throw new TestPilotException(DROP_DATABASE_REST_ENDPOINT_ISSUE,
new IllegalStateException("HTTP/S status code: " + response.statusCode()));
}
}
} while(!done);
}
catch (URISyntaxException e) {
if(githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("delete=ko");
}
catch(IOException ignored) {}
}

throw new TestPilotException(WRONG_MAIN_CONTROLLER_URI, e);
}
catch (IOException | InterruptedException e) {
if(githubOutput != null) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(githubOutput, true)))) {
out.println("delete=ko");
}
catch(IOException ignored) {}
}

throw new TestPilotException(WRONG_MAIN_CONTROLLER_REST_CALL, e);
}
}
Expand Down
Loading