argoproj / argoproj/argo-workflows

One invalid WorkflowTemplate make all WorkflowTemlate invisible

Open
#11,278 5 comments 4 reactions 0 assignees View on GitHub
area/api P3
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 20h
Merged PRs (30d)
138

Description

### Pre-requisites

- [X] I have double-checked my configuration
- [X] I can confirm the issues exists when I tested with `:latest`
- [ ] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/master/docs/CONTRIBUTING.md))

### What happened/what you expected to happen?

- If we have one invalid `WorkflowTemplates` the `argo-server` returns error response `InternalServeError`, then entire `WorkflowTemplates` are invisible.

- ![image](https://github.com/argoproj/argo-workflows/assets/83329336/118fac14-6793-45bb-aa1c-00d76e8b1d45)
- cli
```console
$ argo template -n argo-workflows list
2023/06/29 21:08:17 rpc error: code = Internal desc = json: cannot unmarshal string into Go struct field Container.items.spec.templates.container.command of type []string
```

### Version

latest(v3.4.8)

### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

```YAML
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: good
namespace: argo-workflows
spec:
entrypoint: whalesay-template
templates:
- name: whalesay-template
container:
image: docker/whalesay
command: [cowsay]
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: bad
namespace: argo-workflows
spec:
entrypoint: whalesay-template
templates:
- name: whalesay-template
container:
image: docker/whalesay
command: this-is-invalid

-
```

### Logs from the workflow controller

```text
Logs from workflow server

argo-workflows-server-69ffff554c-7qskg argo-server time="2023-06-29T12:08:03.355Z" level=info duration=6.17825ms method=GET path=/api/v1/workflows/argo size=52 status=0
argo-workflows-server-69ffff554c-7qskg argo-server time="2023-06-29T12:08:17.239Z" level=error msg="finished unary call with code Internal" error="rpc error: code = Internal desc = json: cannot unmarshal string into Go struct field Container.items.spec.templates.container.command of type []string" grpc.code=Internal grpc.method=ListWorkflowTemplates grpc.service=workflowtemplate.WorkflowTemplateService grpc.start_time="2023-06-29T12:08:17Z" grpc.time_ms=2.287 span.kind=server system=grpc
argo-workflows-server-69ffff554c-7qskg argo-server time="2023-06-29T12:08:17.239Z" level=info duration=2.655417ms method=GET path=/api/v1/workflow-templates/argo-workflows size=140 status=500
```

### Logs from in your workflow's wait container

```text
N/A
```

Contributor guide

Open the contributing guide

Research direction

Start at the argo-server ListWorkflowTemplates gRPC method exercised by `argo template -n argo-workflows list`, and reproduce the failure with the provided good and bad WorkflowTemplate YAML. Done means an invalid template no longer prevents valid templates from being listed, with test coverage for this mixed-validity case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc, kubernetes
Domain
api, backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.