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

set Dockerfile WORKDIR to /home/dependabot to avoid permission errors when consumers of the dependabot-core image run bundle install #3495

Merged
merged 3 commits into from
Apr 15, 2021

Conversation

baseballlover723
Copy link
Contributor

@baseballlover723 baseballlover723 commented Apr 15, 2021

Seems like #3398 ended up breaking some scripts that were using the dependabot-core image (such as https://github.com/wemake-services/kira-dependencies and https://github.com/dependabot/dependabot-script). Seems like someone just forgot to set the WORKDIR which causes pwd to be /, which causes dependabot to fail to bundle install, since it doesn't have permission to write to /. This just sets the WORKDIR to the dependabot's home directory so that all of the bundler stuff ends up in a place that dependabot owns.

Note that now the bundler env variables are no longer needed, since they will just go into dependabots home directory. They are still needed, but I moved the directories to be in dependabot's home directory.

I tested that this fixes wemake-services/kira-dependencies#265, and I strongly suspect that it will also fix dependabot/dependabot-script#574 as well.

@baseballlover723 baseballlover723 requested a review from a team as a code owner April 15, 2021 00:12
when consumers of the dependabot-core image run bundle install
Copy link
Contributor

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Dockerfile Outdated
BUNDLE_BIN=".bundle/bin" \
PATH=".bundle/bin:$PATH:/home/dependabot/.bundle/bin"
ENV HOME=/home/dependabot
WORKDIR $HOME
Copy link
Contributor

Choose a reason for hiding this comment

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

"$HOME"

Copy link
Contributor

@feelepxyz feelepxyz left a comment

Choose a reason for hiding this comment

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

Thanks for opening this 🙇 I've pushed a fix restoring the bundle env as it had changed subtly removing one the paths.

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.

bundle install error in image GitLab script fails with Errno::EACCES: Permission denied @ rb_sysopen -
3 participants