Skip to content

Shared sstate volume#6

Open
mrtuborg wants to merge 3 commits into
mainfrom
shared-sstate-volume
Open

Shared sstate volume#6
mrtuborg wants to merge 3 commits into
mainfrom
shared-sstate-volume

Conversation

@mrtuborg

@mrtuborg mrtuborg commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Avoid mixing workdirs from different branches, but still sharing sstate-cache between them

Vladimir Nosenko added 2 commits June 8, 2026 22:04
Split the monolithic workdir volume into two roles:
- Per-branch workdir: /workdir/tmp and /workdir/downloads (TMPDIR, DL_DIR)
- Shared sstate volume: mounted at /sstate-cache (SSTATE_DIR)

Changes:
- config.sh: add SSTATE_VOLUME_NAME, exported alongside VOLUME_NAME
- env_core.sh: add _initialize_sstate_volume(); pre-create /workdir/tmp and
  /workdir/downloads in _initialize_workdir() so chown covers both
- docker_utils.sh: mount sstate volume at /sstate-cache; always inject
  SSTATE_DIR=/sstate-cache and DL_DIR=/workdir/downloads into container
- docker-compose.template.yml: add sstate volume; mount in poky and rpm-host
  (rpm-host serves sstate-cache at /sstate-cache/PATH for mirror use)
- plugins/volume.sh: show sstate volume name in 'volume info'
Previously config.sh unconditionally overwrote SSTATE_VOLUME_NAME with
a value derived from PROJECT_NAME. When CI sets SSTATE_VOLUME_NAME to
point all branches at the shared gh-kirkstone-<hw>-x86_64-sstate volume,
config.sh would overwrite it with the per-branch-named volume derived
from the build directory name.

Use ${SSTATE_VOLUME_NAME:-...} so the env var set by CI takes precedence;
local dev without the env var set gets the existing default behaviour.

@lc-EmLogic lc-EmLogic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not work for me unless I modify BB_ENV_PASSTHROUGH_ADDITIONS - see my comment below.

Comment thread lib/docker_utils.sh
Comment on lines +122 to +123
docker_args+=(-e "SSTATE_DIR=${_sstate_dir}")
docker_args+=(-e "DL_DIR=${_dl_dir}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting them as env variables is not enough, we need to either edit the local.lconf file or put them in BB_ENV_PASSTHROUGH_ADDITIONS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrtuborg I got the full picture now. Setting SSTATE_DIR here isreally ignored. It works because we are setting the default value to /sstate-cache also in here:

My recommendation is hence to remove the ignored env variables from here and rely in that if a user modifies the path it will modify the bblayers.conf locally.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe bblayers.conf is also could be generated to support consistency. As we do that with local.conf.
What do you think about this approach?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that DL_DIR, SSTATE_DIR and TMPDIR do not belong to bblayers.conf in the first place but that they should be in local.conf.

And then, they could/should be generated. For example we could add them to the sample local.conf with ?= operator, and let CI init.sh script append another value if necessary (similar to MACHINE).

Comment thread plugins/volume.sh Outdated
Co-authored-by: Lluis Martinez <lc@emlogic.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants