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

"'/src' is owned by someone else" reported when building status.jenkins.io with docker-hugo #82

Open
MarkEWaite opened this issue Jul 3, 2023 · 2 comments

Comments

@MarkEWaite
Copy link

MarkEWaite commented Jul 3, 2023

We are happy users of the docker-hugo container image to build the https://status.jenkins.io showing the condition of Jenkins infrastructure. We manage that site at https://github.com/jenkins-infra/status and are currently using docker-hugo 0.95.0.

We'd like to upgrade from 0.95.0 to 0.111.3 but our upgrade attempts fail due to an error message from command line git inside the container image. The error message reported by the GitHub action and in local development is:

mwaite@debian11-a:~/hub/infra/status$ docker compose up --build --force-recreate
[+] Building 0.0s (0/0)
[+] Running 1/0
 ✔ Container status-status-1  Recreated                                                                                                                                                           0.1s
Attaching to status-status-1
status-status-1  | Start building sites …
status-status-1  | hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=hugoguru
status-status-1  | ERROR 2023/07/03 23:12:15 Failed to read Git log: fatal: unsafe repository ('/src' is owned by someone else)
status-status-1  | To add an exception for this directory, call:
status-status-1  |
status-status-1  |      git config --global --add safe.directory /src
status-status-1  | Error: Error building site: logged 1 error(s)
status-status-1  | Built in 1165 ms
status-status-1 exited with code 255

Can you suggest changes that we should make in order to allow our site build process to upgrade?

The failing pull request is:

I assume we could create our own container derived from your container with the addition of a RUN git config --global --add safe.directory /src, but I wonder if there is a better way or an easier way.

@MarkEWaite
Copy link
Author

It looks like the best hope for the Jenkins project use of the Hugo container is to switch to a different build. Refer to comments in :

Comments there include a link to https://hub.docker.com/r/floryn90/hugo/tags that provides arm64 and amd64 container images.

MarkEWaite added a commit to MarkEWaite/status that referenced this issue Dec 29, 2023
klakegg/docker-hugo#82 notes that root is the
default user of the container, but that causes issues for our environment
because it blocks git operations.

Switch to run as the current user so that git operations are not
blocked.

Running as the current user means that the Hugo build lock cannot be
written.  Disable it with a command line switch.

Not a perfect solution, but simple enough to allow upgrade to a more
recent Hugo version.
MarkEWaite added a commit to MarkEWaite/status that referenced this issue Dec 29, 2023
klakegg/docker-hugo#82 notes that root is the
default user of the container, but that causes issues for our environment
because it blocks git operations.

Switch to run as the current user so that git operations are not
blocked.

Running as the current user means that the Hugo build lock cannot be
written.  Disable it with a command line switch.

Not a perfect solution, but simple enough to allow upgrade to a more
recent Hugo version.
@MarkEWaite
Copy link
Author

A first attempt to resolve the issue by changing the user ID that runs the Hugo build process:

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

No branches or pull requests

1 participant