Skip to content

Ensure Python 3.6 or 3.7 is installed on all CI shards#7483

Merged
Eric-Arellano merged 10 commits intopantsbuild:masterfrom
Eric-Arellano:py3-all-shards
Apr 3, 2019
Merged

Ensure Python 3.6 or 3.7 is installed on all CI shards#7483
Eric-Arellano merged 10 commits intopantsbuild:masterfrom
Eric-Arellano:py3-all-shards

Conversation

@Eric-Arellano
Copy link
Copy Markdown
Contributor

@Eric-Arellano Eric-Arellano commented Apr 2, 2019

Problem

Once all CI shards are guaranteed to have Python 3, we can port our more complex build-support scripts to Python 3, which will allow us to reduce technical debt and to bring benefits like better argument parsing.

In particular, we want to be able to use Python 3 in those scripts so that we can use subprocess.run().

Solution

For Linux, Travis pre-installs Python 3.6 and 3.7. We simply tell Travis we want those installed, and then set pyenv global to resolve everything for no performance cost.

OSX shards do not have Python 3 installed by default (at least for certain osx_images), so we use Pyenv to install on all shards. This is no longer very costly to do so thanks to caching Pyenv through
#7470.

Result

All shards now have Python 3.6 or 3.7.

Once we update the Centos6 Docker image in #7064, every where in CI will have Python 3. We can in the meantime now start porting scripts if we are confident they are never used by Docker.

@Eric-Arellano Eric-Arellano changed the title WIP: Ensure Python 3.6 or 3.7 is installed on all CI shards Ensure Python 3.6 or 3.7 is installed on all CI shards Apr 3, 2019
@Eric-Arellano Eric-Arellano requested review from cosmicexplorer, illicitonion and stuhood and removed request for cosmicexplorer April 3, 2019 04:54
Copy link
Copy Markdown
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks, nice cleanup.

@Eric-Arellano Eric-Arellano merged commit cba72ae into pantsbuild:master Apr 3, 2019
@Eric-Arellano Eric-Arellano deleted the py3-all-shards branch April 3, 2019 20:04
cosmicexplorer added a commit that referenced this pull request Apr 5, 2019
### Problem

We have used a python 3 interpreter in CI for a while now, using `pyenv` to install this in our Dockerfiles instead of relying on CentOS's `scl` features, which don't allow for multiple pythons at a time. Using `pyenv` to install Python 2.7 as well instead of relying on the package manager allows us to upgrade or modify the image without screwing up our Python installation.

That work began in this PR and ended up in #6981, #7352, #7418, #7483, and more, but it then led to having to duplicate code across `travis_ci` and `travis_ci_py36` Dockerfiles. Using `pyenv` to install python in our `travis_ci` images also involves a significant setup time in bootstrap phases to install our desired pythons. Installing Python in the CentOS 6 base image avoids having to install Python at all in our CI, which saves us minutes in the bootstrap phase.

### Solution

- Use Pyenv to install Python 2.7 and Python 3.6 in the `centos6` Dockerfile.
- Remove `travis_cy_py36`.
- Modify the `travis_ci` Dockerfile to bootstrap pyenv itself if not available.

### Result

We get some CI time back in the bootstrap phase.

### TODO

- [ ] merge this PR
- [ ] publish the new `centos6` image to dockerhub at `pantsbuild/centos6:latest`
- [ ] merge a followup PR removing the manual pyenv bootstrapping from the `travis_ci` image.
stuhood pushed a commit that referenced this pull request Apr 8, 2019
### Problem

We have used a python 3 interpreter in CI for a while now, using `pyenv` to install this in our Dockerfiles instead of relying on CentOS's `scl` features, which don't allow for multiple pythons at a time. Using `pyenv` to install Python 2.7 as well instead of relying on the package manager allows us to upgrade or modify the image without screwing up our Python installation.

That work began in this PR and ended up in #6981, #7352, #7418, #7483, and more, but it then led to having to duplicate code across `travis_ci` and `travis_ci_py36` Dockerfiles. Using `pyenv` to install python in our `travis_ci` images also involves a significant setup time in bootstrap phases to install our desired pythons. Installing Python in the CentOS 6 base image avoids having to install Python at all in our CI, which saves us minutes in the bootstrap phase.

### Solution

- Use Pyenv to install Python 2.7 and Python 3.6 in the `centos6` Dockerfile.
- Remove `travis_cy_py36`.
- Modify the `travis_ci` Dockerfile to bootstrap pyenv itself if not available.

### Result

We get some CI time back in the bootstrap phase.

### TODO

- [ ] merge this PR
- [ ] publish the new `centos6` image to dockerhub at `pantsbuild/centos6:latest`
- [ ] merge a followup PR removing the manual pyenv bootstrapping from the `travis_ci` image.
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.

2 participants