Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions user/build-stages/share-files-s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ This example has 2 build stages:
Here's what the `.travis.yml` config could look like:

```yaml
dist: xenial
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is now optional as xenial is the default distro.


env:
global:
# include $HOME/.local/bin for `aws`
- PATH=$HOME/.local/bin:$PATH

before_install:
# set up awscli packages
- pip install --user awscli
- pyenv global 3.7.1
Copy link
Contributor

@cclauss cclauss Aug 14, 2019

Choose a reason for hiding this comment

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

Why not just put at the top of the script:

language: python
python: 3.7

Or leave out the second line to default to Python 3.6.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the example is meant to work regardless of the language setting, because people may want to use the technique on projects in various languages.

Copy link
Contributor

@cclauss cclauss Aug 14, 2019

Choose a reason for hiding this comment

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

Thanks. Now I understand. Pyenv is superslow so what about this approach which works on Trustry, Xenial, and Bionic?

- python3 -m pip || wget -qO- https://bootstrap.pypa.io/get-pip.py | sudo -H python3
- python3 -m pip install --user awscli
- aws --version  # aws-cli/1.16.217 Python/3.5.2 Linux/4.15.0-1028-gcp botocore/1.12.207

Copy link
Contributor

Choose a reason for hiding this comment

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

No module named pip

I set up a tiny test repository to experiment with what is possible on Travis. I couldn't find any way to use pip on Python 3 without either invoking pyenv or installing pip first - I assume either of those options is unwanted hassle. Feel free to play around and see if there's something I missed, though.

So I think before this example can be changed, it would be necessary to change the default Travis build images, e.g. to include the python3-pip package.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, it works if you install pip first. But I'd imagine people won't especially want an extra install-the-installer step given that the example as it stands works without that.

Copy link
Contributor

@cclauss cclauss Aug 14, 2019

Choose a reason for hiding this comment

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

pyenv takes a minute and a half to build Python 3. I'd imagine people won't especially want an extra slow install-a-language-that-I-don't-need-and-is-already-present step...

Also, pip install -U pip is effectively install-the-installer

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, compared to the example as it currently is, using Python 2.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had a go at adding pip-on-Python 3 to the default images, but I don't really know the infrastructure, I just found a likely looking bit of code:

travis-ci/travis-cookbooks#1055

- pip install -U pip
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to more explicitly use --upgrade than -U to avoid confusion because pip also has a --user option.

- pip install awscli
- mkdir -p ~/$TRAVIS_BUILD_NUMBER
- aws s3 sync s3://travis-build-stages-shared-storage-test/$TRAVIS_BUILD_NUMBER ~/$TRAVIS_BUILD_NUMBER

Expand Down