← Back to issue list

Allow setting of a working directory for the resulting ROCK in rockcraft.yaml

View original Github issue

Metadata

Project
rockcraft
Number
#121
Type
issue
State
open
Author
gruyaume
Labels
—
Created
Updated
Closed
—

Current evaluation

PR #305 provides service-level working-dir support, avoiding cd wrappers, but the requested image-wide OCI WorkingDir for arbitrary exec sessions remains unimplemented.

Suggested action: keep open

Reason: Maintainer @SamirPS identified merged PR #305, and the current schema supports services.<service>.working-dir. However, the request also requires an OCI image-level WorkingDir for arbitrary exec sessions; current code explicitly rejects cmd and entrypoint and contains no WorkingDir implementation, leaving that broader requirement open.

Evaluated by: mr-cal-bot

Impact: 43 Quick Win: 16 Complexity: 42 Confidence: 92 Actionability: 64

Issue body

**Feature Request** Lots of software require the user to be in a given directory before the startup command can be called. As of Today, there is no way to set the working directory of a given rock, the default working directory being "/". This forces users to create an entrypoint (or cmd) that `cd's` in a given directory before calling the actual command). It would be great if a `working-directory` field was added to `rockcraft.yaml` that would set the working directory to the provided path. Here's an example of how the rockcraft.yaml could look: ```yaml name: magma-orc8r-nms-magmalte version: "1.6.0" base: ubuntu:18.04 summary: Magma Orchestrator NMS Magmalte description: Magma Orcestrator NMS Magmalte license: Apache-2.0 platforms: amd64: cmd: ["/bin/yarn", "run", "start:prod"] working-directory: "/usr/src/packages/magmalte/" ``` **Expected behaviour** - The `entrypoint` command is executed from the provided working-directory - At run time, if you `exec` a command in the container, it is executed from the directory provided in the `rockcraft.yaml` file. - Ideally: This working directory is available through environment variables inside of parts (ex. `$WORKING_DIRECTORY`).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 43
Quick Win: 16
Complexity: 42
Confidence: 92
Actionability: 64
keep open PR #305 provides service-level working-dir support, avoiding cd wrappers, but the requested image-wide OCI WorkingDir for arbitrary exec sessions remains unimplemented.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 24
Complexity: 0
Confidence: 75
Actionability: 80
close resolved Feature request to add working-directory field to rockcraft.yaml. PR #305 merged service-level working-dir support in 2023; original author never confirmed if it suffices.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 20
Staleness: 60
Complexity: 35
Confidence: 78
Support Request: 10
close stale Feature request for a working-directory field in rockcraft.yaml to avoid cd wrappers. Core need addressed by service-level working-dir added in PR #305; maintainer triaged in Feb 2026 asking reporter to confirm if service-level is sufficient, no response in ~6 months.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 10
Confidence: 85
Support Request: 10
close stale Request to add a global working-directory field to rockcraft.yaml. Maintainers noted PR #305 added service-level working-dir support and asked if it resolves the request. Awaiting author confirmation after 4+ months of silence.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 90
Support Request: 10
close stale Feature request to add a global working-directory field to rockcraft.yaml. A maintainer recently noted that PR #305 already provides service-level working-dir support, addressing the original use case. Waiting for author confirmation after 4 months of inactivity.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/rockcraft#305 (confidence 96%)

    Added service-level working-dir support, resolving the startup-command cd-wrapper need but not the global OCI WorkingDir requirement.

Related issues

Issue Project State Summary Similarity
#303 add `working-dir` to to service schema rockcraft closed Added working-dir support to Rockcraft's service schema in PR #305, commit 4594740f, after Pebble introduced the field.
72%