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

Build: hardcode the Docker username for now #10172

Merged
merged 5 commits into from
Mar 28, 2023
Merged

Conversation

humitos
Copy link
Member

@humitos humitos commented Mar 21, 2023

This is a quick fix for a hotfix.

RTD_DOCKER_USER is docs:docs so we can't use it inside the path.

Closes #10171

This is a quick fix for a hotfix.

`RTD_DOCKER_USER` is `docs:docs` so we can't use it inside the path.
@humitos humitos requested a review from a team as a code owner March 21, 2023 16:52
@humitos humitos requested a review from stsewd March 21, 2023 16:52
@ericholscher ericholscher added the PR: hotfix Pull request applied as hotfix to release label Mar 21, 2023
humitos added 2 commits March 21, 2023 20:58
These old images are using `pyenv` instead of `asdf`, so we need to use some
different paths to find the binaries.
@humitos humitos requested a review from ericholscher March 27, 2023 09:36
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

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

I think you could simplify it as proposed?

readthedocs/doc_builder/environments.py Show resolved Hide resolved

# On local development, we are using root user
if settings.RTD_DOCKER_COMPOSE:
paths = paths.replace("/home/docs/", "/root/")
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is not part of the else clause?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this is only required for the new Ubuntu images since these use asdf and this path is where asdf is installed.

Copy link
Member

Choose a reason for hiding this comment

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

Can we just use $HOME or similar, instead of adding more hacks? I'm fine with this though for now, assuming we've tested it and it works.

Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

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

The hard-coding makes sense, probably there should be a follow-up issue for this?

Edit: If posting a follow-up issue, it could also note that this area of the code has 0% test coverage, in case its possible to put together a test.

Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

This is the downside of trying to set explicit paths, instead of letting the container define them. Lots of complexity abounds when we start trying to define things like this outside of the container environment.

I'm 👍 on shipping this as a hotfix, but we'll likely get bit by this again in the future, so might be worth trying to see if there's a way to avoid setting these paths.


# On local development, we are using root user
if settings.RTD_DOCKER_COMPOSE:
paths = paths.replace("/home/docs/", "/root/")
Copy link
Member

Choose a reason for hiding this comment

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

Can we just use $HOME or similar, instead of adding more hacks? I'm fine with this though for now, assuming we've tested it and it works.

@humitos
Copy link
Member Author

humitos commented Mar 28, 2023

This is the downside of trying to set explicit paths, instead of letting the container define them.

I prefer to set the environment exactly as we want from the application than rely on the darkness of the things defined in the Dockerfile used to create the image. This approach gives a lot more control and allows us to solve issues without having to rebuild the image 👍🏼

@benjaoming
Copy link
Contributor

@humitos I think it might be tedious to use $HOME and since this is getting cleaned up later anyways, perhaps just leave a code comment with @ericholscher 's suggestion?

@humitos
Copy link
Member Author

humitos commented Mar 28, 2023

@benjaoming @ericholscher I've already tried that and I wasn't able to make $HOME (or any other variable) to expand when using the environment= argument in the DockerAPI call. Not sure why that happens 🤷🏼

The .replace() line is only used for local Docker development, so not a big issue for now.

@benjaoming
Copy link
Contributor

@humitos that's exactly the result I'd fear that you would run into, so best saved for later 👍 and no, not a big issue.

@benjaoming
Copy link
Contributor

AFAICT, this is ready?

@humitos
Copy link
Member Author

humitos commented Mar 28, 2023

@benjaoming yes; I'll do some QA on production in a moment before merging. If everything works as expected, I'll merge and deploy it today.

@humitos
Copy link
Member Author

humitos commented Mar 28, 2023

I QAed this PR with 15 builds (different scenarios) on production and it did work. I'm merging and moving forward here.

@humitos humitos merged commit 331e474 into main Mar 28, 2023
@humitos humitos deleted the humitos/build-hotfix branch March 28, 2023 09:16
@stsewd
Copy link
Member

stsewd commented Mar 28, 2023

Another solution is to first get the current PATH, and then append the new ones to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: hotfix Pull request applied as hotfix to release
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Build failing with /bin/bash: line 1: asdf: command not found
4 participants