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

Update dev and ci Dockerfile to match updater #3279

Merged
merged 1 commit into from
Mar 17, 2021

Conversation

feelepxyz
Copy link
Contributor

@feelepxyz feelepxyz commented Mar 16, 2021

Updating the dev and ci Dockerfile to match the user permissions set by the updater image.

This reproduces the error seen production when updating a vendored bundler project.

The failing bundler specs are expected and fixed here #3280

@feelepxyz feelepxyz force-pushed the feelepxyz/fix-bundler-gem-home-path branch 3 times, most recently from 27ca2fa to c4f8de5 Compare March 16, 2021 12:05
ENV BUNDLE_PATH="/home/dependabot/.bundle" \
BUNDLE_BIN=".bundle/binstubs" \
PATH=".bundle/binstubs:$PATH:/home/dependabot/.bundle/bin"
USER ${USERNAME}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This setup is the same as Dockerfile.development and the updater, previously ci would run as root having access to /var/lib which is the default cache directory for rubygems when GEM_HOME isn't set

@feelepxyz feelepxyz force-pushed the feelepxyz/fix-bundler-gem-home-path branch 4 times, most recently from 65e4ce3 to aa568b6 Compare March 16, 2021 12:14
feelepxyz added a commit that referenced this pull request Mar 16, 2021
This fixes a permissions error when vendoring gems, when `GEM_HOME` was
unset it defaulted to `/var/lib` which isn't writeable.

Attempting to fix the discrepancy between ci and updater here:
#3279
@feelepxyz feelepxyz marked this pull request as ready for review March 16, 2021 14:09
@feelepxyz feelepxyz requested a review from a team as a code owner March 16, 2021 14:09

ENV BUNDLE_PATH="${CODE_DIR}/.bundle" \
BUNDLE_BIN=".bundle/bin"
ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin"
Copy link
Contributor

Choose a reason for hiding this comment

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

$BUNDLE_BIN and $BUNDLE_PATH/bin are now the same value of .bundle/bin - do we still need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this tripped me up several times, the BUNDLE_BIN is set to a relative path but the BUNDLE_PATH isn't

Copy link
Contributor

Choose a reason for hiding this comment

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

🦅 👁️

Good catch!

COPY --chown=${USERNAME}:${USERNAME} nuget/ ${CODE_DIR}/nuget/
COPY --chown=${USERNAME}:${USERNAME} python/ ${CODE_DIR}/python/
COPY --chown=${USERNAME}:${USERNAME} terraform/ ${CODE_DIR}/terraform/
COPY --chown=${USERNAME}:${USERNAME} omnibus/ ${CODE_DIR}/omnibus/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems COPY defaults to the file being owned by root, this was failing when running rspec and loading the vcr configuration that attempted to create a folder here: https://github.com/dependabot/dependabot-core/blob/main/common/spec/spec_helper.rb#L38 (vcr codes)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the default COPY behaviour is surprising.

To reduce repetition we need to update this, we could just chown -r ${CODE_DIR} after the copy block? I don't feel strongly about making that change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm attempted to run a chwon -r ${CODE_DIR} after the copy but looks like its failing and running out of disk space, reverting to the inline option https://github.com/dependabot/dependabot-core/runs/2122700298

Copy link
Contributor

@brrygrdn brrygrdn left a comment

Choose a reason for hiding this comment

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

Nits only, change LGTM - thanks for making this change as that was definitely causing a lot of subtle issues.

@feelepxyz feelepxyz force-pushed the feelepxyz/fix-bundler-gem-home-path branch 2 times, most recently from 51c8e58 to 42c0761 Compare March 17, 2021 09:29
Updating the dev and ci Dockerfile to match the user permissions set by
the updater image.

This reproduces the error seen production when updating a vendored
bundler project.
@feelepxyz feelepxyz force-pushed the feelepxyz/fix-bundler-gem-home-path branch from 42c0761 to 5e32580 Compare March 17, 2021 13:41
@feelepxyz feelepxyz merged commit 6f40826 into main Mar 17, 2021
@feelepxyz feelepxyz deleted the feelepxyz/fix-bundler-gem-home-path branch March 17, 2021 18:40
feelepxyz added a commit that referenced this pull request Mar 22, 2021
This reverts #3279

It looks like this change has broken ci builds on `main`:
https://github.com/dependabot/dependabot-core/runs/2168623534

Reverting this change until we've figured out a fix for it.
jurre added a commit that referenced this pull request Mar 23, 2021
Revert Update dev and ci Dockerfile to match updater #3279
feelepxyz added a commit that referenced this pull request Mar 23, 2021
@thepwagner thepwagner mentioned this pull request Mar 23, 2021
feelepxyz added a commit that referenced this pull request Apr 1, 2021
This was only added because of the changes here
#3279 which where
reverted here #3320

This step sometimes takes over a minute.
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