Skip to content

Commit

Permalink
feat: add retry API for archived workflows. Fixes argoproj#7906 (argo…
Browse files Browse the repository at this point in the history
…proj#7988)

Signed-off-by: Dillen Padhiar <dpadhiar99@gmail.com>
  • Loading branch information
dpadhiar committed Mar 23, 2022
1 parent 4d17ffb commit 8cde762
Show file tree
Hide file tree
Showing 19 changed files with 1,383 additions and 95 deletions.
20 changes: 20 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6604,6 +6604,26 @@
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
58 changes: 58 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,44 @@
}
}
},
"/api/v1/archived-workflows/{uid}/retry": {
"put": {
"tags": [
"ArchivedWorkflowService"
],
"operationId": "ArchivedWorkflowService_RetryArchivedWorkflow",
"parameters": [
{
"type": "string",
"name": "uid",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Workflow"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
}
}
},
"/api/v1/cluster-workflow-templates": {
"get": {
"tags": [
Expand Down Expand Up @@ -10904,6 +10942,26 @@
}
}
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
}
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiclient/http1/archived-workflows-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func (h ArchivedWorkflowsServiceClient) ListArchivedWorkflowLabelValues(_ contex
return out, h.Get(in, out, "/api/v1/archived-workflows-label-values")
}

func (h ArchivedWorkflowsServiceClient) RetryArchivedWorkflow(_ context.Context, in *workflowarchivepkg.RetryArchivedWorkflowRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Put(in, out, "/api/v1/archived-workflows/{uid}/retry")
}

func (h ArchivedWorkflowsServiceClient) ResubmitArchivedWorkflow(_ context.Context, in *workflowarchivepkg.ResubmitArchivedWorkflowRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Put(in, out, "/api/v1/archived-workflows/{uid}/resubmit")
Expand Down
504 changes: 460 additions & 44 deletions pkg/apiclient/workflowarchive/workflow-archive.pb.go

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions pkg/apiclient/workflowarchive/workflow-archive.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pkg/apiclient/workflowarchive/workflow-archive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ message ListArchivedWorkflowLabelKeysRequest {
message ListArchivedWorkflowLabelValuesRequest {
k8s.io.apimachinery.pkg.apis.meta.v1.ListOptions listOptions = 1;
}
message RetryArchivedWorkflowRequest {
string uid = 1;
string name = 2;
string namespace = 3;
bool restartSuccessful = 4;
string nodeFieldSelector = 5;
}

message ResubmitArchivedWorkflowRequest {
string uid = 1;
string name = 2;
Expand All @@ -47,6 +55,12 @@ service ArchivedWorkflowService {
rpc ListArchivedWorkflowLabelValues (ListArchivedWorkflowLabelValuesRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.LabelValues) {
option (google.api.http).get = "/api/v1/archived-workflows-label-values";
}
rpc RetryArchivedWorkflow (RetryArchivedWorkflowRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Workflow) {
option (google.api.http) = {
put: "/api/v1/archived-workflows/{uid}/retry"
body: "*"
};
}
rpc ResubmitArchivedWorkflow (ResubmitArchivedWorkflowRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Workflow) {
option (google.api.http) = {
put: "/api/v1/archived-workflows/{uid}/resubmit"
Expand Down
64 changes: 64 additions & 0 deletions sdks/java/client/docs/ArchivedWorkflowServiceApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Method | HTTP request | Description
[**archivedWorkflowServiceListArchivedWorkflowLabelValues**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceListArchivedWorkflowLabelValues) | **GET** /api/v1/archived-workflows-label-values |
[**archivedWorkflowServiceListArchivedWorkflows**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceListArchivedWorkflows) | **GET** /api/v1/archived-workflows |
[**archivedWorkflowServiceResubmitArchivedWorkflow**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceResubmitArchivedWorkflow) | **PUT** /api/v1/archived-workflows/{uid}/resubmit |
[**archivedWorkflowServiceRetryArchivedWorkflow**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceRetryArchivedWorkflow) | **PUT** /api/v1/archived-workflows/{uid}/retry |


<a name="archivedWorkflowServiceDeleteArchivedWorkflow"></a>
Expand Down Expand Up @@ -410,3 +411,66 @@ No authorization required
**200** | A successful response. | - |
**0** | An unexpected error response. | - |

<a name="archivedWorkflowServiceRetryArchivedWorkflow"></a>
# **archivedWorkflowServiceRetryArchivedWorkflow**
> IoArgoprojWorkflowV1alpha1Workflow archivedWorkflowServiceRetryArchivedWorkflow(uid, body)


### Example
```java
// Import classes:
import io.argoproj.workflow.ApiClient;
import io.argoproj.workflow.ApiException;
import io.argoproj.workflow.Configuration;
import io.argoproj.workflow.models.*;
import io.argoproj.workflow.apis.ArchivedWorkflowServiceApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:2746");

ArchivedWorkflowServiceApi apiInstance = new ArchivedWorkflowServiceApi(defaultClient);
String uid = "uid_example"; // String |
IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest body = new IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest(); // IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest |
try {
IoArgoprojWorkflowV1alpha1Workflow result = apiInstance.archivedWorkflowServiceRetryArchivedWorkflow(uid, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ArchivedWorkflowServiceApi#archivedWorkflowServiceRetryArchivedWorkflow");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**uid** | **String**| |
**body** | [**IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest**](IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest.md)| |

### Return type

[**IoArgoprojWorkflowV1alpha1Workflow**](IoArgoprojWorkflowV1alpha1Workflow.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | A successful response. | - |
**0** | An unexpected error response. | - |

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
**namespace** | **String** | | [optional]
**nodeFieldSelector** | **String** | | [optional]
**restartSuccessful** | **Boolean** | | [optional]
**uid** | **String** | | [optional]



Loading

0 comments on commit 8cde762

Please sign in to comment.