Skip to content

Build: log usage of old output directory _build/html #10038

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

Merged
merged 5 commits into from
Feb 23, 2023

Conversation

humitos
Copy link
Member

@humitos humitos commented Feb 16, 2023

We have changed the output directory from _build/html to $READTHEDOCS_OUTPUT/html in the last few weeks.

However, there are some projects that may have _build/html directory hardcoded in different places (e.g. conf.py). We want to log these projects and contact them to communicate this situation.

Ideally, we should show a warning in the build detail's page, but I don't think we currently have a way to display a warning message. We only support error messages in this page.

build_1     | [warning  ] Directory '_build/html' exists. This may lead to unexpected behavior. [readthedocs.telemetry.collectors] build_id=2756 builder=c9b06583941f commit=None ip=10.10.0.100 path_resolved=/usr/src/app/checkouts/readthedocs.org/user_builds/c9b06583941f/test-builds/checkouts/old-output-directory/.readthedocs.yaml project_slug=test-builds request_id=8bfcc743-dbc4-4886-8da0-b8a36709e556 task_id=ecbd1cd2-f352-43e0-be35-9442b1cab77e user_id=1 version_slug=old-output-directory

Related #10036

We have changed the output directory from `_build/html` to
`$READTHEDOCS_OUTPUT/html` in the last few weeks.

However, there are some projects that may have `_build/html` directory hardcoded
in different places (e.g. `conf.py`). We want to log these projects and contact
them to communicate this situation.

Ideally, we should show a warning in the build detail's page, but I don't think
we currently have a way to display a warning message. We only support error
messages in this page.

Related #10036
@humitos humitos requested a review from a team as a code owner February 16, 2023 08:45
@humitos humitos requested a review from stsewd February 16, 2023 08:45
@humitos humitos requested a review from agjohnson February 16, 2023 08:45
)
if code == 0:
log.warning(
"Directory '_build/html' exists. This may lead to unexpected behavior."
Copy link
Contributor

Choose a reason for hiding this comment

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

We should raise something user facing as well. I'm still a huge +1 on better error/warning patterns, but would it make sense to set the Build.error here? If there is something in this path, that almost certainly mean the build will be missing content if we don't fail the build explicitly.

# and log these projects so we can communicate with their maintainers
#
# This temporal and should be removed in the future once we have
# decided what to do with this collected data.
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably aren't as concerned about collecting this data as we are about saving user builds from having bad content. Anyone using doxygen and friends could have _build/html hardcoded, and will have silently broken docs.

@agjohnson
Copy link
Contributor

We want to log these projects and contact them to communicate this situation.

It seems easier on us to just emit a build error. Is there a strong reason not to raise a build error instead?

@humitos
Copy link
Member Author

humitos commented Feb 22, 2023

@agjohnson the only reason was that I thought we didn't want to fail the build. I will update this PR (or close it and open a new one) to raise an error and clearly communicate this to the users.

@agjohnson
Copy link
Contributor

Also, I'm not against logging this for our purposes either, that seems wise too. If we're really unsure how many builds might fail from this, that's perhaps a reason to add logging first. But it seems there probably aren't a lot of projects hitting this scenario, so I'm 👍 on jumping right to failing, and probably as soon as we can. If you think there are a lot of builds that will hit this, let's start with logging, but follow up very soon with build failures.

@humitos
Copy link
Member Author

humitos commented Feb 23, 2023

@agjohnson OK. I updated this PR so it goes out next week and we start collecting this data. I will open a new PR that fails the build completely in those cases, but we may not get in time to deploy it next week tho.

@humitos humitos enabled auto-merge (squash) February 23, 2023 17:06
@humitos humitos merged commit d499203 into main Feb 23, 2023
@humitos humitos deleted the humitos/log-usage-old-output-directory branch February 23, 2023 18:16
humitos added a commit that referenced this pull request Mar 8, 2023
humitos added a commit that referenced this pull request Mar 9, 2023
* Build: check for `_build/html` directory and fail if exists

Continuation of #10038
Closes #10036

* Update exception message

Co-authored-by: Anthony <[email protected]>

---------

Co-authored-by: Anthony <[email protected]>
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.

3 participants