-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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.commands
shall support custom package installation (build.apt_packages
)
#9599
Comments
I think this is a good feature and I'd like to make it possible somehow. We are currently not allowing
Is it secure to allow people to execute only one command via
My concern here is people running things like |
Yeah, sudoers policies are hard to get right and are a common exploit target. There are similar exploits to yours that would allow root access.
So, this is where I've always seen The linked configuration file above is using build.commands, but seems it could just use build.jobs instead. The config is duplicating what our build process already does, but does a second build pass in addition. To use build.jobs instead, it could still build a secondary Sphinx project and would get all of the benefits of our existing build features (package installation, apt package installation, etc). |
build.commands
shall support custom package installation
This is a good point and I agree that it should work for this particular case 💯 . @danwos would you like to try this approach using That said, even if it works for this case, I still think it's a good feature to develop eventually. I don't think it's a priority tho, in particular because we don't have/know many cases where this situation will be a limitation that cannot be achieved by I've already faced that use cases when trying to build https://sphinx-themes.org/ on Read the Docs. It uses |
Yeah, this does feel like a disconnect, but I think we're probably in agreement on priority too. I would probably still want to discuss a way to reference existing features from build.commands before reimplementing this with another build process pattern. I imagine there is a configuration file pattern that we might like around referencing build job steps from build.commands, like: build:
commands:
- readthedocs: install-apt-packages
- readthedocs: install-python-packages
# Or
- /usr/bin/readthedocs-install-apt-packages
# Etc Or perhaps the long term plan of providing this customization using a buildpack like structure would be another conversation. |
I'd prefer if we don't build anything inside the core application for this and we push forward the build contract instead (#9088). Once we have that implemented, we can execute the build process in a completely isolated instance outside our application and we can give people full control of it (even with root permissions). We only need to know where the artifacts generated by that process are and copy them back to our application instance before post-processing and uploading them to S3. |
FYI, at scientific-python dev summit, we've been trying to implement a Jekyll build in readthedocs, and apt commands are needed to install ruby (Ruby as a tool would be exactly what we want, actually!). Just wanted to show another use case that doesn't work with |
@henryiii just to clarify, are you using |
Our first attempt was with And setting up the Python virtual env takes a little useless time. :) |
Okay yeah, this is exactly the case we discussed then. You have pinpointed the current issue, and you will need to get creative with build.jobs to replace the build command step for building. With the ability to override this step too, |
We should probably add Ruby to "build.tools" options. There is no reason to not have it there |
@henryiii BTW, you could solve your immediate issue by doing something like: build:
commands:
# Install Ruby using "asdf"
- asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
- asdf install ruby 2.6.4
- asdf global ruby 2.6.4
# ... your other commands here |
This is what we ended up with: (Also 1-3 of the Zarr webpages are setup like this now too) It takes about 7 mins, 5 of which are building Ruby, and 1.5 or so are building four of the plugins that Jekyll needs (Ruby doesn't have Python's redistributable "wheels", just an "SDists" equivalent). If we could avoid building Ruby, that would be a nice savings, and if we could cache the binaries, we could save most of the rest of the time. Ruby was already installed on the runners, we were just missing the headers package, otherwise we probably could have used the built-in Ruby (though I'd still have to come up with the right environment variable incantation to use it without sudo, but should be possible). |
Glad the yaml snippet helped here. #10346 will improve the download/compiling time spent on Ruby. We cannot cache package/gem installation, tho, but at least the compiling time will be saved. We can continue the conversation on that issue, since we are deviating the topic a little from this original issue 👍 |
I'd like to prioritize adding support for I think it will be hard for us to feel good about implementing a sudo layer for build.commands usage, so there is a more obvious path in making Do we want to treat this as a separate issue (perhaps there is one already, but I wasn't finding it)? |
Yes. Overriding pre-defined jobs (e.g. |
Yeah, the two are different, technically speaking, but what I'm saying is that if we add support for overriding I'm also not suggesting to do anything like remove |
Gotcha! I think for a lot of cases |
I ended up here while trying to enable |
@ssbarnea we have a |
build.commands
shall support custom package installationbuild.commands
shall support custom package installation (build.apt_packages
)
Why is there this discussion and decision to wait for future infrastructure updates when simply supporting I'm running into the same problem and such a fix would do everything I need it to do. |
It seems that Instead what should have been introduced is a way to override the |
@ktbarrett the thoughts/patterns behind this decision are:
That said, we weren't able to add support for Supporting I hope that helps to clarify the situation. Footnotes
|
Yes, I understand what's intended here. What I'm saying is that a solution achievable now would be a separate feature that would allow the user to override the |
Yes. We've discussing this internally and we already have a plan to move forward. However, we weren't able to prioritize this work yet.
Right, if you want to build Sphinx or MkDocs projects you probably don't need to override it. However, if you want to build a project that uses Pelican, Docusaurus or any other documentation tool, you definitely will need |
I have felt that even Pelican/Docusaurus/etc should all be supported with build:
jobs:
build:
html:
- pelican --settings docs/pelicanconf.py --output $READTHEDOCS_OUTPUT/html/ docs/ To me, the |
I think this issue is deviating a little from its original purpose at this point. @agjohnson that workflow probably works for most of the Python doctools. However for any non-Python doctool it doesn't make too much sense to create a virtualenv, install pre defined dependencies, etc. We will need to un-tie our current build process from Sphinx/MkDocs and Python more to support other doctools with We've touched on "other pre-defined build packages" that's related to this, but that's for a different conversation that is outside the scope of adding sudo support for |
Yeah, I'm not talking that deep on package reuse yet. This conversation is centered around finishing the overrides to There is work in build job overrides, but duplicating It's good to be mindful of what we're designing for, but I also feel like designing primarily for non-Python tools is a preoptimization. Python projects are the vast majority of projects and gain more from an intermediate configuration of |
I ended up on this issue because I discovered that Not only that rsync is missing, but any attempt to download and install the binary will fail because it will not have access to required system libraries, rsync is not really a portable executable.
Reference: RsyncProject/rsync#72 |
@ssbarnea As a data point, what are you doing with your build that requires To clarify/summarize the above, if projects can use the override |
@agjohnson I was wondering about the same. Long story short, I am using Still, considering that the Update: Apparently nope, we cannot hack the old process because the hardcoded call of |
That makes sense for where we are currently. But with build:
apt_packages: rsync
jobs:
build:
html:
- tox -e docs
- mv .tox/docs/tmp/html $READTHEDOCS_OUTPUT/html This is just an example of course. The hard-coded The intention behind |
Hello, I have problem - I need apt_packages working with commands . I have to override the default commands with own commands, but I also need Ubuntu apt_packages. This is the my .readthedocs.yaml file:
|
@miroi Your example matches what we are talking about above. Users using However, your use case seems like you should be able to use our default build steps with additional To clarify what our plan is here, we will not support APT package installation in combination with build.commands, but instead will support overriding our default commands in build.jobs configuration. We are working on implementing overrides for |
Hello @agjohnson , is it fixed here please, #11710 ? |
Yes! This PR is merged but not released yet. It will be included in our release tomorrow |
Could you please help me how to arrange my .readthedocs.yaml file after this feature is merged in ? I need APT packages and run the setup command with make html...And avoid the default commands, which are causing crash...
still the default commands are showing up and are hurting the final html....
|
OK, I found the solution - mere, ugly delete of wrong "html" directory, created by default buildup:
I still do not know how to avoid the default commands :
|
@miroi you should use something like the following (probably, with some adjustments): version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- cmake
- gfortran
- gcc
- g++
- git
jobs:
post_checkout:
- git submodule update --init --recursive
install:
- pip install "sphinx<7.0.0" sphinx_rtd_theme sphinxcontrib-bibtex
pre_build:
- ./setup $READTHEDOCS_OUTPUT
build:
html:
- make html I haven't tested it, but it seems this is the YAML structure you are looking for. |
Thanks @humitos ! After some playing got a working yaml file, based on your template:
|
We've deployed some changes related to our builders. Now it's possible to override That means that you can write a YAML file like the following: version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- cmake
jobs:
build:
html:
- make html
pdf:
- make pdf Note that this build:
This approach should be enough for those users that require having full control of the Read the Docs building process and also need to use apt-get to install OS level dependencies. Let us know if this helps you with your use case. We really appreciate your feedback. We plan to keep expanding the |
Details
This is based on a comment from @humitos : #3885 (comment)
build.commands
does not allow to install extra packages viabuild.apt_packages
.Even if
build.commands
gives me more flexibility in the build process, it takes also a lot of "features" away from me, because I'm not able load/install additional, non-python programs/libs anymore.Expected Result
Take
build.apt_packages
into account when usingbuild.commands
.Or allow using
sudo apt-get install XY
.Use case
I want to run PlantUML, which normally works on RTD.
But I also need a custom build, as I must build 2 PDFs before building my HTML docs.
Used Config: RTD-file of Sphinx-SimplePDF
Without PlantUML, the Sphinx-Needs extension can not be used to build any kind of diagram.
So in the end, for this use case, all I need is Java in machines when using
build.commands
:)The text was updated successfully, but these errors were encountered: