PyPi Upload with API token not working

I recently switched to API token based authentication for uploading packages to PyPi.

As the tokens are too long to be encrypted using travis-cli, I set the PYPI_PASSWORD environment variable instead. This relies on this feature: https://github.com/travis-ci/dpl/blob/v1.10.12/lib/dpl/provider/pypi.rb#L12 referenced in this issue https://github.com/travis-ci/travis.rb/issues/221

This worked like a charm in my first tagged build: https://travis-ci.org/blue-yonder/sqlalchemy_exasol/jobs/591866904#L924

But for the second tagged build, I ran into the following issue: https://travis-ci.org/blue-yonder/sqlalchemy_exasol/jobs/592508182#L927

“missing PyPI password”

I dropped the old token and issued a new one at PyPi, added it again to the environment. Still no success when rerunning that build.

I looked at the diff between the two tags (2.0.7 and 2…0.8) of my repo, but nothing relating to Travis: https://github.com/blue-yonder/sqlalchemy_exasol/compare/2.0.7...2.0.8

Any idea on where I could look to find the root cause of the build failing?

> travis encrypt --repo native-api/test_travis TOKEN=pypi-AgEIcHlwaS5vcmcCJGE4OTI5OGM4LWY5MWEtNGI5ZS05M2Q4LTBkMzkwZmEyMTIyNgACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX0AAAYg9li4PCqk6OT8WZhUr_mLrf6ZLMmR5qpQ3dFxleaCE50
Please add the following to your .travis.yml file:

  secure: "kEq9bDSr5TI8wbTM4tzvrWF2vsH2CcCb0fUnQlgHqgiFgNIJgL0sHLz3xAJRAsZE803AQhGkMvdQQ86vb9vQ5cdO1CC2X9fWqjQCd7WHGVokrj6qbt82gcd7heharKlQFRN+ScpJMyVQFtzQfZ5mkcwZGTgel9tRJdbsg1uaJENDbqbOE3fhTAoMIud5LK5IbtkqO7+U9EQZj2SesBSYxCAAsPP0L09tqSLCfjt8/fCklG0Za2AZekIOQJHu+OgAIhMeQN7Z1bLa+mmpjQD3xRxAwOmB58g0kpqFinlaAvv9IdEVKJBTBGyacr/KMiQAmgn8zBD6oYt+SSex/SDygfIsR7zSv3sQk3aAS9BqqOCMT7qMGmQEBDIyN2P+auoE08MkoZ8iHywGDXeysRVxq5KwjSQwPTkNAMxKJN1ij8OyslJPrUC84dab7eRQQZMKx/ZkNnvwS8RG6sXs3aJhxYzb/mzZsuiBdI1z6WDCNzq1ufhjXNrqQ4sVdql6Z07aN3dmav6W6j/97gcen9aM5ipZVFWCHWMvx9/2c+az2pDQIH0R6gCwTsTM4VbG6CocUP3wXf8JiyKF8ISE5KcfNVOMEzrvex2ItowFMxCH5E9ctNpvHcwArg5JBZaY8cjXkWSJ6n1YzL+CO8RgA0XkTdodB1oL9CvZ73x7VxKk="

Comparing https://travis-ci.org/blue-yonder/sqlalchemy_exasol/jobs/591866904#L315-L318 and https://travis-ci.org/blue-yonder/sqlalchemy_exasol/jobs/592508182#L315-L317, PYPI_PASSWORD is no longer set in your repository settings.

Good catch! Now I wonder why that is, as the variable is set in the project settings. I have restricted the variable to the master branch. I will try out a new key that is not restricted to master and see if that makes this variable show up again.

What is your Travis CLI version. On running that command I get the output
data too large - consider using travis encrypt-file or travis env set

My travis cli version is 1.8.10

That’s the reason. Tag builds are not considered to be on the master branch (a tag is effectively a branch that you cannot add further commits to).

Same, installed with gem install travis into a clean ruby 2.4.7p357 (2019-08-28 revision 67796) [x64-mingw32]; the command is run from a Start Command Prompt with Ruby prompt. Maybe you are formatting the command wrong or something.

https://travis-ci.org/blue-yonder/sqlalchemy_exasol/jobs/592508182 is green again and upload works.
As @native-api pointed out, tag builds are not considered master which makes sense.
Thank you for the quick support!