Skip to content

👷📦🚀 Enable Travis CI to publish dists to PYPI - #262

Merged
Mariatta merged 15 commits into
python:masterfrom
webknjaz:feature/travis-cd-to-pypi
Aug 4, 2018
Merged

Mariatta merged 15 commits into
python:masterfrom
webknjaz:feature/travis-cd-to-pypi

Conversation

@webknjaz

@webknjaz webknjaz commented Jun 10, 2018 •

Copy link
Copy Markdown
Member

Resolves #222

@Mariatta you still need to update secret and probably add @brettcannon's account for blurb.

Some hacks present are trying to work around limitations described in travis-ci/dpl#822

Comment thread .travis.yml Outdated
# This happenes when other CI (AppVeyor etc.) has already uploaded
# the very same dist (usually sdist).
skip-existing: true
user: Mariatta # TODO: consider having a separate "uploader user"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Mariatta you might want to set up a separate account with "Maintainer" level privileges in PYPI to use instead of your own, which is more dangerous if it gets compomised.

Recently, we've started replacing our flows to use a deployment-dedicated user in aio-libs as well: https://github.com/aio-libs/aiohttp/blob/master/.travis.yml#L84

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Mariatta I've just realized that blurb is deployed by @brettcannon and your account is not linked to that dist. Will you fix this by having an account with access to publish both or should I separate deployment step to have different deployer users?

Comment thread .travis.yml Outdated
# Encrypt with `travis encrypt -r python/core-workflow --org` while using travis-ci.org;
# change to `travis encrypt -r python/core-workflow --api-endpoint 'https://api.travis-ci.com/'`
# upon switch to __free__ travis-ci.com:
secure: PLACE_YOUR_ENCRYPTED_PASSWORD_HERE

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Mariatta feel free to update the PR branch with a secret generated for your account as per instructions in comments above.

@webknjaz
webknjaz force-pushed the feature/travis-cd-to-pypi branch 4 times, most recently from 076f934 to 91b4aab Compare June 11, 2018 11:49
@webknjaz

Copy link
Copy Markdown
Member Author

@Mariatta I've fixed conditionals.

Demo:

It should be ready for merging (you may add PYPI creds before or after merge).

@webknjaz

webknjaz commented Jun 22, 2018 •

Copy link
Copy Markdown
Member Author

@Mariatta I'm going to update this to exclude non-related builds when releasing a certain tool. This will include conditions: v1 and moving stuff off the matrix to explicit jobs.include.

Ref: travis-ci/travis-conditions#1

@Mariatta

Mariatta commented Jul 9, 2018

Copy link
Copy Markdown
Member

tag cherry-picker-v1.2.19: https://travis-ci.com/webknjaz/core-workflow/builds/75899965

That build failed. Any clue?

Just to confirm how this will work, when I'm ready to release to PyPI, just create a tag like cherry-picker-vX.Y.Z and travis will run?

@webknjaz

Copy link
Copy Markdown
Member Author

@Mariatta oh it's fine.

HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

I didn't put any valid PYPI credentials there. That's why this happened. It will work once you add credentials as per https://github.com/python/core-workflow/pull/262/files#diff-354f30a63fb0907d4ad57269548329e3R54.
(You can push those to my branch bound to this PR via UI or Git)

@webknjaz
webknjaz force-pushed the feature/travis-cd-to-pypi branch from f0c6de3 to 6886155 Compare July 10, 2018 16:00
@webknjaz

Copy link
Copy Markdown
Member Author

@Mariatta I've made jobs appearence more granular for release mode.

@webknjaz

Copy link
Copy Markdown
Member Author

@Mariatta just in case it gets lost in diff page, we need to solve this as well: #262 (comment)

@webknjaz

Copy link
Copy Markdown
Member Author

@Mariatta do you need any additional help with this?

@Mariatta

Mariatta commented Aug 1, 2018

Copy link
Copy Markdown
Member

@webknjaz I've asked @brettcannon to create the bot account for deployment to PyPI. Not sure if he's gotten around doing it yet.

@webknjaz

webknjaz commented Aug 1, 2018

Copy link
Copy Markdown
Member Author

@Mariatta alternatively you could create a shared acc yourself and then you can add it to one project with minimal privileges and @brettcannon would add it to other. If this helps :)

@brettcannon

Copy link
Copy Markdown
Member

I just created the core-workflow account.

@brettcannon

Copy link
Copy Markdown
Member

https://pypi.org/user/core-workflow/

Comment thread .travis.yml Outdated
# Encrypt with `travis encrypt -r python/core-workflow --org` while using travis-ci.org;
# change to `travis encrypt -r python/core-workflow --api-endpoint 'https://api.travis-ci.com/'`
# upon switch to __free__ travis-ci.com:
secure: PLACE_YOUR_ENCRYPTED_PASSWORD_HERE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @brettcannon for creating the core-workflow PyPI user. I've added it as maintainer to cherry_picker in PyPI.
Do you mind creating the encrypted password and add it here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sent the password to Mariatta securely as I'm heading out for a short vacation once I'm done with my GitHub notifications 😄

Comment thread .travis.yml Outdated
# This happenes when other CI (AppVeyor etc.) has already uploaded
# the very same dist (usually sdist).
skip-existing: true
user: &pypi-user Mariatta # TODO: consider having a separate "uploader user"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has to be core-workflow now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

May I expect that you will update this branch yourself?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If not - please share the encrypted string and I'll do it myself :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've updated. At least I think I did it correctly ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks fine. Sometimes it doesn't work because of corrupted secret value, but we'll only see this during actual deployment in this repo. Re-encryption usually helps.

Comment thread .travis.yml Outdated
env:
TARGET_PKG: blurb
deploy:
<<: *deployment-config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know if blurb maintainers (I'm not one of them) want the same capability or not. Maybe we need to remove this portion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't really like removing stuff. Instead, we can add smth likeif: false to disable this. Deal?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok :)

Comment thread .travis.yml
- &run-if-tagged
if: tag IS present
- &run-if-cherry-picker
if: tag =~ ^cherry\-picker\-v\d+\.\d+\.\d+$

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Mariatta I'm a bit concerned about restricting this to vX.Y.Z format, while in real life there might be some extensions (dev/a/b). Should I extend this regexp to take those into account?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can leave the regex as is (handling vX.Y.Z) and when the need arise we can adjust it later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, I just thought of a common use case for testing pre-releases when you are unsure whether build artifact (dist) is correct.

@webknjaz

webknjaz commented Aug 4, 2018

Copy link
Copy Markdown
Member Author

I believe that you can merge this now.

@webknjaz

webknjaz commented Aug 4, 2018

Copy link
Copy Markdown
Member Author

I would then test releasing mechanizm, but since it's a change, which does not affect the software, I'd add .post0. It looks like a right thing to do.

@Mariatta Mariatta left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!!! 🌮

@Mariatta
Mariatta merged commit 084b51e into python:master Aug 4, 2018
@Mariatta

Mariatta commented Aug 4, 2018

Copy link
Copy Markdown
Member

Once we have updated changelog for cherry_picker (open issue #279), I can try to cut a release. But I'm about to head to the beach now 🏖 ...

@webknjaz

webknjaz commented Aug 4, 2018

Copy link
Copy Markdown
Member Author

🎉

@webknjaz

webknjaz commented Aug 4, 2018

Copy link
Copy Markdown
Member Author

Yeah, actually me too: just arrived to Cyprus a few hours ago 🌴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants