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

Automate compile version & upload to S3 #179

Merged
merged 23 commits into from
Apr 14, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 4, 2022

Initial idea coming from
https://github.com/readthedocs/readthedocs-ops/issues/1155 showing how we can
maybe automate this process.

Initial idea coming from
readthedocs/readthedocs-ops#1155 showing how we can
maybe automate this process.
@humitos humitos requested a review from agjohnson April 4, 2022 16:02
@humitos humitos self-assigned this Apr 4, 2022
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
humitos added a commit to readthedocs/readthedocs.org that referenced this pull request Apr 12, 2022
Avoid uploading the .tar.gz to production S3 since we will be managing this via
CircleCI and an AWS orbs. See
readthedocs/readthedocs-docker-images#179

We need to keep the upload part for development environment, tho.
.circleci/config.yml Outdated Show resolved Hide resolved
@humitos
Copy link
Member Author

humitos commented Apr 13, 2022

I was able to run the first test on this --let's see how it goes. It should end up with all the artifacts uploaded to -dev S3 buckets

Screenshot_2022-04-13_16-03-10

@humitos
Copy link
Member Author

humitos commented Apr 13, 2022

It seems I'm pretty close to having something working already. There are some of the jobs that succeed and I see the artifacts uploaded into -dev S3 buckets 💪🏼

We can polish the script a little more, but we need to keep in mind that we need the script to keep being compatible for local development since we need to upload the artifacts to MinIO when working locally.

@humitos humitos requested a review from agjohnson April 13, 2022 15:00
@humitos
Copy link
Member Author

humitos commented Apr 13, 2022

This could end up in weird production states. For example when some check passes and some others fail. In that case, we will be updating only some versions to production.

Note that this already happened while testing this PR.

@humitos humitos marked this pull request as ready for review April 13, 2022 15:39
@humitos
Copy link
Member Author

humitos commented Apr 13, 2022

Another thing that I don't have solved yet is how to make docker pull command to use the full name of the ubuntu image (including the date): ubuntu-22.04-2022.03.15, but then when uploading the .tar.gz to S3 name it without the date: ubuntu-20.04-python-3.10.0.tar.gz, which is how it's currently working in production (see https://github.com/readthedocs/readthedocs.org/blob/ccdad233cda5bcd3ac3acd935536c9e8cfc2e440/readthedocs/doc_builder/python_environments.py#L73-L76)

@humitos
Copy link
Member Author

humitos commented Apr 13, 2022

I decided to avoid using matrix together with parameters because it spins up one job per os and tool/version, having to download the docker images each time.

Now, I'm using a similar approach to the one commented in https://github.com/readthedocs/readthedocs-ops/issues/1155#issuecomment-1082615972 that:

  • iterates over all the docker images and download them all
  • use those images to build each tool/version
  • upload all the tools/versions at once using AWS sync

This makes better usage of resources and should be way faster. The downside, it's bashy 😄

Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

Looks great! This seems much better than the process we had prior.

Last couple pieces look to be just switching from your branches to main. Safe to do that now?

@humitos
Copy link
Member Author

humitos commented Apr 14, 2022

@agjohnson done! We should merge readthedocs/readthedocs.org#9098 first and then this branch. After that, all the .tar.gz will be uploaded to S3 -dev buckets. Then we can update the environment variables with -prod buckets and re-trigger the CircleCI job for the final test.

Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

🤖📦🛫

@agjohnson
Copy link
Contributor

Failure is just on docs. Imma merge this.

@agjohnson agjohnson merged commit 649cf2e into main Apr 14, 2022
@agjohnson agjohnson deleted the humitos/automate-compile-upload-s3 branch April 14, 2022 18:38
@agjohnson
Copy link
Contributor

Bah, wrong PR somehow. Oops.

agjohnson pushed a commit to readthedocs/readthedocs.org that referenced this pull request Apr 14, 2022
* Build: do not upload `build.tool` to production S3

Avoid uploading the .tar.gz to production S3 since we will be managing this via
CircleCI and an AWS orbs. See
readthedocs/readthedocs-docker-images#179

We need to keep the upload part for development environment, tho.

* Build: join TOOL and VERSION with a `-` to simplify CircleCI routine

* Do not delete .tar.gz from local host when on production

* Remove old documentation

We are not going to run this command in production by hand anymore. However, in
case it's required, I'm linking to the issue that explains how to do it.

* Skip uploading when running from inside CIRCLECI

* Split docker iamge name from full to just keep the name without date

* Revert "Split docker iamge name from full to just keep the name without date"

This reverts commit e08a7de.

* Receive arguments as previously

* Comment about pinning transitive dependencies

* Build Python 3.6.15 using `clang`
@agjohnson
Copy link
Contributor

I cancelled the running build (which had pulled down script from main on readthedocs.org before the corresponding PR was merged), and restarted the workflow:

https://app.circleci.com/pipelines/github/readthedocs/readthedocs-docker-images/238/workflows/36835669-d367-44bd-817e-29bd4f8ed93d/jobs/424

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants