← Back to issue list

`source-subdir` Not Working With `override-build`

View original Github issue

Metadata

Project
rockcraft
Number
#967
Type
issue
State
closed
Author
MattiaSarti
Labels
Type: Documentation Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

No code fix was made: legacy source-subdir behavior with override-build was retained for compatibility; craft-parts#1374 documents the limitation.

Resolution: closed not a bug

Reason: Maintainer @tigarmo said on 2025-10-03 that changing the behavior would break existing cd workarounds and that an earlier fix had been reverted, so no correction was pursued. craft-parts#1374, commit a69a088c, documents that override-build does not honor source-subdir.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description In `rockcraft.yaml`, while other `source-` part properties seem to work, `source-subdir` does not, at least when `override-build` is specified as well. ### To Reproduce With Rockcraft **_1.13.0_**, run `rockcraft pack` on the **_rockcraft.yaml_** file introduced with [this pull request](https://github.com/canonical/kubeflow-model-registry-rocks/pull/10), first by keeping the original source (which works) and then undoing the workaround of [this comment](https://github.com/canonical/kubeflow-model-registry-rocks/pull/10#discussion_r2348258259) (which gives the bug). ### Environment Rockcraft **_1.13.0_** on Ubuntu 24.04 LTS. ### rockcraft.yaml ```yaml # Dockerfile: https://github.com/kubeflow/model-registry/blob/v0.2.22/clients/ui/Dockerfile name: model-registry-ui summary: An image for the User Interface (UI) of Kubeflow Model Registry description: An image for the User Interface (UI) of Kubeflow Model Registry version: "0.2.22" license: Apache-2.0 base: ubuntu@24.04 platforms: amd64: run-user: _daemon_ services: ui: command: /bff [ --deployment-mode=kubeflow --port=8080 ] override: replace summary: "model registry ui service" startup: enabled entrypoint-service: ui parts: security-team-requirement: plugin: nil override-build: | mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query ui: plugin: nil source: https://github.com/kubeflow/model-registry.git # NOTE: "source-subdir" does not seem to work, but as a workaround "cd" can # be run as the first command of the "override-build" section below # source-subdir: clients/ui/frontend source-tag: v0.2.22 source-type: git build-environment: - DEPLOYMENT_MODE: kubeflow - STYLE_THEME: mui-theme build-snaps: - node/20/stable override-build: |- cd clients/ui/frontend npm cache clean --force npm ci --omit=optional npm run build:prod cp -r dist $CRAFT_PART_INSTALL/static/ bff: plugin: nil source: https://github.com/kubeflow/model-registry.git # NOTE: "source-subdir" does not seem to work, but as a workaround "cd" can # be run as the first command of the "override-build" section below # source-subdir: clients/ui/bff source-tag: v0.2.22 source-type: git build-environment: - CGO_ENABLED: "0" - GOARCH: amd64 - GOOS: linux build-snaps: - go/1.24/stable override-build: |- cd clients/ui/bff go mod download go build -a -o bff ./cmd cp bff $CRAFT_PART_INSTALL/bff ``` ### Relevant log output ```shell The expected subdirectory source is not found and the override-build commands fail. ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug No code fix was made: legacy source-subdir behavior with override-build was retained for compatibility; craft-parts#1374 documents the limitation.
stealth/space-bunny-alpha — closed not a bug No code fix was merged: compatibility behavior was retained; craft-parts PR #1374 documented that source-subdir does not change override-build's working directory.
stealth/space-bunny-alpha — closed not a bug Closed without a behaviour change: maintainers kept source-subdir ignored by override-build (a prior fix broke Snapcraft users). craft-parts PR #1374 (commit a69a088c) documented the actual behaviour; tracked internally as ROCKCRAFT-272.
stealth/space-bunny-alpha — closed stale No fix was merged: Rockcraft retained source-subdir’s existing behavior with override-build to avoid breaking Snapcraft users; documentation was proposed instead.
qwen/qwen3.6-35b-a3b — — Closed without a code fix due to backward compatibility concerns, as correcting the behavior would break existing workarounds. Documentation updates will clarify the current limitation.
qwen/qwen3.6-35b-a3b — — Closed without a code fix. Maintainers declined to correct the source-subdir behavior with override-build to avoid breaking existing projects using workarounds. Documentation will be updated to clarify the actual behavior.
qwen/qwen3.6-35b-a3b — — Closed without a code fix. Maintainers declined to correct source-subdir behavior with override-build to avoid breaking existing workarounds. The issue was resolved by updating documentation to reflect the current behavior instead.
qwen3.6-35b-a3b-mtp-q6 — — Closed as wontfix. Fixing the bug would break existing projects relying on the current workaround. The team decided to maintain backward compatibility and will update documentation to clarify the behavior.

Update history

No update history recorded yet.

Related work

  • Related To: craft-parts#1374 (confidence 95%)

    Documentation commit a69a088c clarifies the source-subdir and override-build interaction without changing compatibility behavior.

Related issues

Issue Project State Summary Similarity
#1676186 the build scriptlet doesn't take into account the source-subdir snapcraft (launchpad) open craft-parts intentionally runs override-build from the part build directory; source-subdir applies to plugin builds, and the documentation explicitly exempts override-build.
78%
#427 Using `source-subdir` results in `No such file or directory` craft-parts open Documented behavior: source-subdir sets the plugin build location, but override-build runs from the build root; callers must cd into the subdirectory themselves.
74%
#1374 docs: clarify relation between `source-subdir` and `override-build` craft-parts merged Merged PR #1374 as commit a69a088c, documenting that source-subdir restricts normal build commands but does not change override-build's working directory, resolving rockcraft#967 via docs.
72%