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

Configurable user IDs #429

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

etcwilde
Copy link
Contributor

When working with these containers to debug issues locally, it's sometimes useful to have the source directory live on the host, while building in the container. In order for permissions to line up, the user ID numbers need to match or the build-user may not be able to create the necessary directories.

This patch allows setting the build-user user ID so that the permissions line up and the user in the container and host can manipulate the files.

Override the build user ID with the current user's ID is done with the following command to ensure that the permissions on any volumes are kept in sync is the following:
docker build --build-arg BUILD_USER_ID=$(id -u) ...

@etcwilde etcwilde requested a review from shahmishal as a code owner November 11, 2024 23:13
@etcwilde
Copy link
Contributor Author

@swift-ci please test

@etcwilde etcwilde force-pushed the ewilde/configurable-build-user-id branch from 315ee05 to a6f52e6 Compare February 13, 2025 22:04
@etcwilde
Copy link
Contributor Author

I'm going to need more output than [FAILED] - swift-ci/main/ubuntu/24.04/Dockerfile.
I am unable to reproduce a failure with this Dockerfile locally.

@shahmishal
Copy link
Member

In the artifact step, you should see a link to download the logs.

Artifact download URL: https://github.com/swiftlang/swift-docker/actions/runs/13317949874/artifacts/2589170704

@etcwilde
Copy link
Contributor Author

CentOS 7:

#6 0.359 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

Ubuntu 23.10:

#7 0.293 Ign:1 http://security.ubuntu.com/ubuntu mantic-security InRelease
#7 0.293 Ign:2 http://archive.ubuntu.com/ubuntu mantic InRelease
#7 0.369 Err:3 http://security.ubuntu.com/ubuntu mantic-security Release
#7 0.369   404  Not Found [IP: 185.125.190.83 80]
#7 0.369 Ign:4 http://archive.ubuntu.com/ubuntu mantic-updates InRelease
#7 0.445 Ign:5 http://archive.ubuntu.com/ubuntu mantic-backports InRelease
#7 0.521 Err:6 http://archive.ubuntu.com/ubuntu mantic Release
#7 0.521   404  Not Found [IP: 185.125.190.83 80]
#7 0.598 Err:7 http://archive.ubuntu.com/ubuntu mantic-updates Release
#7 0.598   404  Not Found [IP: 185.125.190.83 80]
#7 0.674 Err:8 http://archive.ubuntu.com/ubuntu mantic-backports Release
#7 0.674   404  Not Found [IP: 185.125.190.83 80]

Ubuntu 24.04:

tar: usr/lib/libLTO.so.15git: Cannot write: No space left on device
...

Docc:

#5 ERROR: failed to register layer: write /usr/lib/x86_64-linux-gnu/libicudata.so.57.1: no space left on device

Static SDK

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref c134ce27-11c9-4288-a10a-13dadbadd510::xc4kljypnmeqd83a464gmh764: "/resources": not found

Most of these look like either the distro is EOL or an infra issue. I can avoid the EOL distros. I'm not sure what is happening with the static SDK though. Will see if I can reproduce that. This change shouldn't have an effect.

@etcwilde
Copy link
Contributor Author

Ah, ci_test.py is trying to build the static SDK from a different directory than the directory that the Dockerfile is in, which doesn't work because the Dockerfile copies in the resources directory, which is situated next to the Dockerfile.

Running: docker build --no-cache=true -f swift-ci/sdks/static-linux/Dockerfile .

COPY resources /resources

@etcwilde etcwilde force-pushed the ewilde/configurable-build-user-id branch from a6f52e6 to 11730a5 Compare February 14, 2025 20:37
When working with these containers to debug issues locally, it's
sometimes useful to have the source directory live on the host, while
building in the container. In order for permissions to line up, the user
ID numbers need to match or the build-user may not be able to create
the necessary directories.

This patch allows setting the build-user user ID so that the permissions
line up and the user in the container and host can manipulate the files.

Override the build user ID with the current user's ID is done with the
following command to ensure that the permissions on any volumes are
kept in sync is the following:
`docker build --build-arg BUILD_USER_ID=$(id -u) ...`
@etcwilde etcwilde force-pushed the ewilde/configurable-build-user-id branch from 11730a5 to 6721040 Compare February 18, 2025 18:49
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