-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Build: use new Docker images from design document #8453
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
Changes from 34 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
c3cec8a
Build: use new Docker images from design document
humitos b553dc8
Script to compile a version and upload it to the cache (S3)
humitos 3c3e51e
Compile Python with `--enable-shared`
humitos 49e489d
Terminate the script on failures
humitos 8948587
Pass --env to docker exec properly
humitos 677ec6c
Typo
humitos d2da08d
Comment the Python compilation options for now
humitos 0415235
Rename variable to not hide `os` module
humitos 94ce225
Make compile&upload to work with Python 2.7 and its dependencies
humitos fd322bb
Don't run tar with `--verbose`
humitos 1ea6c60
Use bash for the script
humitos d86e1b9
Add `awscli` dependency to upload .tar.gz to S3 (MinIO)
humitos 6d2f4ed
Reduce sleep time
humitos 5f0df77
Pass the variables to the sub-process so `aws` can access to them
humitos 1029806
Fix MinIO default password in script
humitos 3bac624
Pass the variables to `aws` again :)
humitos 81d957b
Merge branch 'master' into humitos/build-new-docker-image
humitos eb932b8
Update `if` to avoid installing Python dependencies on conda/mamba
humitos 128a361
Merge branch 'humitos/build-new-docker-image' of github.com:readthedo…
humitos 009bff1
Remove the container used on timeout
humitos 213a4bd
Rename `install_languages` to `install_build_languages`
humitos f34b3cb
Rename `build.languages` to `build.tools`
humitos 2d9f899
Merge branch 'master' of github.com:readthedocs/readthedocs.org into …
humitos 7964292
Decide whether to use conda/mamba
humitos c2a4b2f
Minor fixes
humitos 00c2ec1
Use `ubuntu-20.04` as `build.os`
humitos 46ca944
Select proper docker image based on build.os
humitos 6b7fa2f
Move `install_build_tools()` inside `setup_python_environment()`
humitos edc52c7
Decide conda or mamba executable based on config.build.tools.python
humitos 80bba7f
Install tools only if build.os and build.tools are defined
humitos e6c05a4
Remove feature flag
humitos 0e0c08b
Better syntax
humitos c5f920e
Update with latest config object changes
humitos 5f8b4e8
Merge branch 'master' of github.com:readthedocs/readthedocs.org into …
humitos 2131b74
Test we are executing the asdf commands required
humitos f2735ae
Feedback addressed with new config file options
humitos 063d2b3
Lint
humitos 1e42d8d
Merge branch 'master' of github.com:readthedocs/readthedocs.org into …
humitos 326b231
Fix tests
humitos fba017d
Patch pyenv-build to not upgrade conda
humitos 9528849
Do not patch pyenv-build anymore
humitos 94231b9
Explain $1 and $2 arguments for the script
humitos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ argh==0.26.2 | |
|
||
# run tests | ||
tox==3.24.4 | ||
|
||
# AWS utilities to use against MinIO | ||
awscli==1.20.34 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
# | ||
# | ||
# Script to compile a languge version and upload it to the cache. | ||
# | ||
# This script automates the process to build and upload a Python/Node/Rust/Go | ||
# version and upload it to S3 making it available for the builders. When a | ||
# pre-compiled version is available in the cache, builds are faster because they | ||
# don't have to donwload and compile. | ||
# | ||
# LOCAL DEVELOPMENT ENVIRONMENT | ||
# https://docs.readthedocs.io/en/latest/development/install.html | ||
# | ||
# You can run this script from you local environment to create cached version | ||
# and upload them to MinIO. For this, it's required that you have the MinIO | ||
# instance running before executing this script command: | ||
# | ||
# inv docker.up | ||
# | ||
# | ||
# PRODUCTION ENVIRONMENT | ||
# | ||
# To create a pre-compiled cached version and make it available on production, | ||
# the script has to be ran from a builder (build-default or build-large) and | ||
humitos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# it's required to set the following environment variables for an IAM user with | ||
# permissions on ``build-tools`` S3's bucket: | ||
# | ||
# AWS_ACCESS_KEY_ID | ||
# AWS_SECRET_ACCESS_KEY | ||
# AWS_ENDPOINT_URL | ||
# | ||
# | ||
# USAGE | ||
# | ||
# ./scripts/compile_version_upload.sh python 3.9.6 | ||
# | ||
# | ||
|
||
set -e | ||
|
||
# Define variables | ||
SLEEP=350 | ||
OS="ubuntu-20.04" | ||
TOOL=$1 | ||
VERSION=$2 | ||
|
||
# Spin up a container with the Ubuntu 20.04 LTS image | ||
CONTAINER_ID=$(docker run --user docs --rm --detach readthedocs/build:$OS sleep $SLEEP) | ||
echo "Running all the commands in Docker container: $CONTAINER_ID" | ||
|
||
# Install the tool version requested | ||
if [[ $TOOL == "python" ]] | ||
then | ||
docker exec --env PYTHON_CONFIGURE_OPTS="--enable-shared" $CONTAINER_ID asdf install $TOOL $VERSION | ||
else | ||
docker exec $CONTAINER_ID asdf install $TOOL $VERSION | ||
fi | ||
|
||
# Set the default version and reshim | ||
docker exec $CONTAINER_ID asdf global $TOOL $VERSION | ||
docker exec $CONTAINER_ID asdf reshim $TOOL | ||
|
||
# Install dependencies for this version | ||
if [[ $TOOL == "python" ]] && [[ ! $VERSION =~ (^miniconda.*|^mambaforge.*) ]] | ||
humitos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
then | ||
RTD_PIP_VERSION=21.2.4 | ||
RTD_SETUPTOOLS_VERSION=57.4.0 | ||
RTD_VIRTUALENV_VERSION=20.7.2 | ||
|
||
if [[ $VERSION == "2.7.18" ]] | ||
then | ||
# Pin to the latest versions supported on Python 2.7 | ||
RTD_PIP_VERSION=20.3.4 | ||
RTD_SETUPTOOLS_VERSION=44.1.1 | ||
RTD_VIRTUALENV_VERSION=20.7.2 | ||
fi | ||
docker exec $CONTAINER_ID $TOOL -m pip install -U pip==$RTD_PIP_VERSION setuptools==$RTD_SETUPTOOLS_VERSION virtualenv==$RTD_VIRTUALENV_VERSION | ||
fi | ||
|
||
# Compress it as a .tar.gz without include the full path in the compressed file | ||
docker exec $CONTAINER_ID tar --create --gzip --directory=/home/docs/.asdf/installs/$TOOL --file=$OS-$TOOL-$VERSION.tar.gz $VERSION | ||
|
||
# Copy the .tar.gz from the container to the host | ||
docker cp $CONTAINER_ID:/home/docs/$OS-$TOOL-$VERSION.tar.gz . | ||
|
||
# Kill the container | ||
docker container kill $CONTAINER_ID | ||
|
||
# Upload the .tar.gz to S3 | ||
AWS_ENDPOINT_URL="${AWS_ENDPOINT_URL:-http://localhost:9000}" | ||
AWS_BUILD_TOOLS_BUCKET="${AWS_BUILD_TOOLS_BUCKET:-build-tools}" | ||
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-admin}" \ | ||
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-password}" \ | ||
aws --endpoint-url $AWS_ENDPOINT_URL s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET | ||
|
||
# Delete the .tar.gz file from the host | ||
rm $OS-$TOOL-$VERSION.tar.gz |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.