Workbench Job template produces invalid YAML for long working directories containing spaces

Open Beginner friendly
#969 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #970 by @bcpierson-lilly — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
yaml
Domain
build-system

Research direction

Start with the Workbench Job template’s workingDir rendering expression and compare it with the similar indent and trimPrefix pattern referenced in commit 1986ad36. Render the template using the long synthetic path with spaces from the issue, then check that the output parses as YAML and preserves the exact directory string.

Written by the indexing model from the issue text.

Description

team: launcher team: workbench

Description

The Workbench Job template renders workingDir with toYaml but does not indent continuation lines. When serialization wraps a long path at spaces, the generated YAML is invalid and Kubernetes rejects the Job before execution. I reproduced this with rstudio-workbench chart 0.21.5, template version 2.5.0, and Workbench 2026.07.1-ubuntu-24.04. The current upstream template also contains the affected expression.

Reproduction details

Submit an audited job using /usr/bin/true and this synthetic working directory:

/home/example/a long directory with enough spaces to exercise wrapping at the serializer line width - continuation looks like a YAML list

The directory doesn't need to exist to actually reproduce the YAML rejection, the error occurs before container startup.

Observed results:

  • A short working directory and a 154-character path without spaces both launched successfully.
  • A long path containing spaces returned HTTP 500 with Kubernetes API failure.
    • Launcher logs showed Kubernetes HTTP 400 with a YAML parsing error. The reported line number varies with the rendered document.

Suggested correction

gotemplate
workingDir: {{ toYaml .Job.workingDirectory | indent 12 | trimPrefix (repeat 12 " ") }}

Local rendering tests with this correction produced valid YAML and preserved the exact directory string. A similar fix with the same indent / trimPrefix pattern was applied to other fields in commit 1986ad36.

Dominant language
Markdown
Stars
46
Forks
39
Avg merge
16h 27m
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/helm

All issues in rstudio/helm

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.