Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for multi user approval in suspend. fixes #12108 #13570

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
34 changes: 34 additions & 0 deletions api/jsonschema/schema.json

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

78 changes: 78 additions & 0 deletions api/openapi-spec/swagger.json

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

1 change: 1 addition & 0 deletions docs/executor_swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -3515,6 +3515,7 @@ otherwise).

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| approvers | []string| `[]string` | | | List of approvers emails that are required to review the workflow before lifting the suspend.</br>TODO: define minimum length of at least 1 | |
| duration | string| `string` | | | Duration is the seconds to wait before automatically resuming a template. Must be a string. Default unit is seconds.</br>Could also be a Duration, e.g.: "2m", "6h" | |


Expand Down
2 changes: 2 additions & 0 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ WorkflowStatus contains overall status information about a workflow
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`approversStatus`|`Map< boolean , string >`|Approvers list for Suspend state|
|`artifactGCStatus`|[`ArtGCStatus`](#artgcstatus)|ArtifactGCStatus maintains the status of Artifact Garbage Collection|
|`artifactRepositoryRef`|[`ArtifactRepositoryRefStatus`](#artifactrepositoryrefstatus)|ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile.|
|`compressedNodes`|`string`|Compressed and base64 decoded Nodes map|
Expand Down Expand Up @@ -3173,6 +3174,7 @@ SuspendTemplate is a template subtype to suspend a workflow at a predetermined p
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`approvers`|`Array< string >`|List of approvers emails that are required to review the workflow before lifting the suspend.|
|`duration`|`string`|Duration is the seconds to wait before automatically resuming a template. Must be a string. Default unit is seconds. Could also be a Duration, e.g.: "2m", "6h"|

## LabelValueFrom
Expand Down

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

8 changes: 8 additions & 0 deletions manifests/base/crds/full/argoproj.io_cronworkflows.yaml

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

24 changes: 24 additions & 0 deletions manifests/base/crds/full/argoproj.io_workflows.yaml

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

4 changes: 4 additions & 0 deletions manifests/base/crds/full/argoproj.io_workflowtasksets.yaml

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

8 changes: 8 additions & 0 deletions manifests/base/crds/full/argoproj.io_workflowtemplates.yaml

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

4 changes: 4 additions & 0 deletions pkg/apiclient/argo-kube-workflow-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (c *argoKubeWorkflowServiceClient) SetWorkflow(ctx context.Context, req *wo
return c.delegate.SetWorkflow(ctx, req)
}

func (c *argoKubeWorkflowServiceClient) ApproveWorkflow(ctx context.Context, req *workflowpkg.WorkflowApproveRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) {
return c.delegate.ApproveWorkflow(ctx, req)
}

func (c *argoKubeWorkflowServiceClient) TerminateWorkflow(ctx context.Context, req *workflowpkg.WorkflowTerminateRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) {
return c.delegate.TerminateWorkflow(ctx, req)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiclient/error-translating-workflow-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ func (c *errorTranslatingWorkflowServiceClient) SetWorkflow(ctx context.Context,
return workflow, grpcutil.TranslateError(err)
}

func (c *errorTranslatingWorkflowServiceClient) ApproveWorkflow(ctx context.Context, in *workflowpkg.WorkflowApproveRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) {
workflow, err := c.delegate.ApproveWorkflow(ctx, in)
return workflow, grpcutil.TranslateError(err)
}

func (c *errorTranslatingWorkflowServiceClient) StopWorkflow(ctx context.Context, req *workflowpkg.WorkflowStopRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) {
workflow, err := c.delegate.StopWorkflow(ctx, req)
return workflow, grpcutil.TranslateError(err)
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiclient/http1/workflow-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func (h WorkflowServiceClient) SetWorkflow(ctx context.Context, in *workflowpkg.
return out, h.Put(ctx, in, out, "/api/v1/workflows/{namespace}/{name}/set")
}

func (h WorkflowServiceClient) ApproveWorkflow(ctx context.Context, in *workflowpkg.WorkflowApproveRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Put(ctx, in, out, "/api/v1/workflows/{namespace}/{name}/approve")
}

func (h WorkflowServiceClient) LintWorkflow(ctx context.Context, in *workflowpkg.WorkflowLintRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Post(ctx, in, out, "/api/v1/workflows/{namespace}/lint")
Expand Down
4 changes: 4 additions & 0 deletions pkg/apiclient/offline-workflow-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (o OfflineWorkflowServiceClient) SetWorkflow(context.Context, *workflowpkg.
return nil, OfflineErr
}

func (o OfflineWorkflowServiceClient) ApproveWorkflow(context.Context, *workflowpkg.WorkflowApproveRequest, ...grpc.CallOption) (*wfv1.Workflow, error) {
return nil, OfflineErr
}

func (o OfflineWorkflowServiceClient) LintWorkflow(_ context.Context, req *workflowpkg.WorkflowLintRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
err := validate.ValidateWorkflow(o.namespacedWorkflowTemplateGetterMap.GetNamespaceGetter(req.Namespace), o.clusterWorkflowTemplateGetter, req.Workflow, validate.ValidateOpts{Lint: true})
if err != nil {
Expand Down
Loading