mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(codepipeline): wait for custom jobs while stopping (#3678)
* fix(codepipeline): preserve custom action stop status * fix(codepipeline): wait for custom jobs while stopping Signed-off-by: XuJian <xujian.top@gmail.com> * test(codepipeline): cover custom jobs while stopping Signed-off-by: XuJian <xujian.top@gmail.com> --------- Signed-off-by: XuJian <xujian.top@gmail.com> Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
This commit is contained in:
1 parent
86072aaa84
commit
c317fa52d2
2 files changed
+203
-6
No files matched your search
+12
-4
@@ -1244,7 +1244,7 @@ public class CodePipelineService {
|
||||
stored.set("job", job);
|
||||
storeItem(execution.getAccountId(), execution.getRegion(), "job", jobId, "Created", stored);
|
||||
state.setExternalExecutionId(jobId);
|
||||
while (!execution.isStopRequested()) {
|
||||
while (!(execution.isStopRequested() && execution.isAbandon())) {
|
||||
CodePipelineStoredItem current = requireItem(
|
||||
execution.getAccountId(), execution.getRegion(), "job", jobId, "JobNotFoundException");
|
||||
if ("Succeeded".equals(current.getStatus())) {
|
||||
@@ -1256,12 +1256,20 @@ public class CodePipelineService {
|
||||
return;
|
||||
}
|
||||
if ("Failed".equals(current.getStatus())) {
|
||||
throw new AwsException("ActionExecutionFailed",
|
||||
current.getData().path("result").path("failureDetails").path("message")
|
||||
.asText("Custom action failed"), 400);
|
||||
String message = current.getData().path("result").path("failureDetails").path("message")
|
||||
.asText("Custom action failed");
|
||||
if (execution.isStopRequested()) {
|
||||
state.setStatus("Failed");
|
||||
state.setSummary(message);
|
||||
state.setErrorDetails(Map.of("code", "ActionExecutionFailed", "message", message));
|
||||
return;
|
||||
}
|
||||
throw new AwsException("ActionExecutionFailed", message, 400);
|
||||
}
|
||||
TimeUnit.MILLISECONDS.sleep(POLL_INTERVAL_MS);
|
||||
}
|
||||
state.setStatus("Abandoned");
|
||||
state.setSummary("Action abandoned.");
|
||||
}
|
||||
|
||||
private void applyExecutionMode(CodePipelineExecution execution) {
|
||||
|
||||
Reference in new issue
Block a user