canonical / snapcraft-rocks

Sources for Snapcraft as OCI images, maintained by the Starcraft team
GNU General Public License v3.0
4 stars 1 forks source link

`--workdir` is ignored #40

Open VladRassokhin opened 3 months ago

VladRassokhin commented 3 months ago

Not sure whether it's a bug of run-snapcraft.sh or pebble.

In the old official docker container it was possible to place snapcraft.yaml into an arbitrary directory (e.g. mount it as ...:/build/snapcraft.yaml:ro) and use --workdir=/build. Now it doesn't work and gives following error:

2024-04-29T09:59:11.631Z [snapcraft] Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
2024-04-29T09:59:11.631Z [snapcraft] Recommended resolution: To start a new project, use `snapcraft init`

Whole docker args if you're interested (paths removed and newlines added for readability):

docker
run
--rm
--volume=/work/out/idea-ce/dist.snap.amd64/snapcraft.yaml:/build/snapcraft.yaml:ro
--volume=/work/out/idea-ce/dist.snap.amd64/intellij-idea-community.desktop:/build/snap/gui/intellij-idea-community.desktop:ro
--volume=/work/out/idea-ce/dist.snap.amd64/intellij-idea-community.png:/build/prime/meta/gui/icon.png:ro
--volume=/work/out/idea-ce/dist.snap.amd64/result:/build/result
--volume=/work/out/idea-ce/dist.all:/build/dist.all:ro
--volume=/work/out/idea-ce/temp/linux.dist.snap.product-info.json.amd64:/build/dist.product-json:ro
--volume=/work/out/idea-ce/dist.unix.x64:/build/dist.unix:ro
--volume=/work/community/build/download/jbr_jcef-21.0.3b442.1-linux-x64:/build/jre:ro
--workdir=/build
ghcr.io/canonical/snapcraft:8_core22@sha256:ea7434407f1ccede1feee183b982b23e1914a36267701063c392fb299a04dd89
snap
--build-for=amd64
-o
result/intellij-idea-community_2024.2-EAP_amd64.snap

Turns out one must inspect sources (https://github.com/canonical/snapcraft-rocks/blob/core22-8/rockcraft.yaml) and use /project. Is it documented anywhere?

VladRassokhin commented 3 months ago

Turns out the path is specified in README, but missing in the announcement. That still doesn't explain why custom directory cannot be used.