Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sub-package directories in WorkDir before building subpackage #1649

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

smoser
Copy link
Contributor

@smoser smoser commented Nov 14, 2024

Moving the creation of the subpackage dir before running the pipelines means that the subpackage directory was created as the user that ran melange rather than the user that is doing the build. Those uids can be different depending on the runner.

SBOMs are written as the uid that invoked melange. It assumes that it can create Workspace/package-dir/var/lib/db/sbom . Previously, the 'package-dir' portion of that would sometimes get created by the uid inside the build (probably as a result of 'mkdir -p ${{targets.contextdir}}/usr/bin' or the like). The result was that the uid running melange could not create var/lib/db/sbom because it did not have write perms to package-dir.

By creating package-dir first, we (mostly) ensure that we can later create var/lib/db/sbom, and this will succeed more often.

There is still a problem in that we assume that we can write there. Some part of the build might create var/lib/db and have all those tokens as 755 with a different uid. The right solution is probably to do the population from inside the Runner.

This improves the situation for
#1254, but does not entirely fix it.

Moving the creation of the subpackage dir before running the
pipelines means that the subpackage directory was created as
the user that ran melange rather than the user that is
doing the build.  Those uids can be different depending on
the runner.

SBOMs are written as the uid that invoked melange.  It assumes
that it can create Workspace/package-dir/var/lib/db/sbom . Previously,
the 'package-dir' portion of that would sometimes get created
by the uid inside the build (probably as a result of
'mkdir -p ${{targets.contextdir}}/usr/bin' or the like).  The result
was that the uid running melange could not create var/lib/db/sbom
because it did not have write perms to package-dir.

By creating package-dir first, we (mostly) ensure that we can later
create var/lib/db/sbom, and this will succeed more often.

There is still a problem in that we assume that we can write there.
Some part of the build might create var/lib/db and have all those
tokens as 755 with a different uid.  The right solution is probably
to do the population from inside the Runner.

This improves the situation for
chainguard-dev#1254,
but does not entirely fix it.

Signed-off-by: Scott Moser <[email protected]>
@smoser smoser merged commit 70bbb7d into chainguard-dev:main Nov 14, 2024
36 checks passed
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