Skip to content

Travis configuration now does extra tag validation #1101

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

Merged
merged 3 commits into from
Mar 10, 2020

Conversation

fabianvf
Copy link
Contributor

@fabianvf fabianvf commented Mar 10, 2020

Separate build matrix into 3 stages - verify-tag, test, and deploy

  • verify-tag compares the kubernetes.__version__ to $TRAVIS_TAG. Only
    runs on pushed tags
  • test runs the actual tests
  • deploy deploys the package to pypi. Only runs on pushed tags

Separate build matrix into 3 stages - verify-tag, test, and deploy
- verify-tag compares the kubernetes.__version__ to $TRAVIS_TAG. Only
runs on pushed tags
- test runs the actual tests
- deploy deploys the package to pypi. Only runs on pushed tags
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2020
@k8s-ci-robot k8s-ci-robot requested review from roycaihw and yliaog March 10, 2020 15:18
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 10, 2020
@roycaihw
Copy link
Member

/cc @palnabarun

@k8s-ci-robot k8s-ci-robot requested a review from palnabarun March 10, 2020 16:14
@fabianvf
Copy link
Contributor Author

fabianvf commented Mar 10, 2020

Travis doesn't seem to have picked this up, which I assume implies a major mistake on my end

edit: The script started with [ which made travis interpret it as a list

@fabianvf fabianvf closed this Mar 10, 2020
@fabianvf fabianvf reopened this Mar 10, 2020
@palnabarun
Copy link
Member

@fabianvf Thank you for splitting the stages out. I was working on it on the side. :)

.travis.yml Outdated
- stage: verify-tag
python: 3.7
script: |
[ "v$(python -c 'import kubernetes ; print(kubernetes.__version__)')" == "${TRAVIS_TAG}" ]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also put in a check to make sure that the TRAVIS_TAG obeys semver

Copy link
Member

Choose a reason for hiding this comment

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

I was going to say that. This would, in turn, ensure that the version that we put in constants.py is also validated.

Copy link
Member

@palnabarun palnabarun left a comment

Choose a reason for hiding this comment

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

LGTM!

python: 3.7
script: >
[ "v$(python -c 'import kubernetes ; print(kubernetes.__version__)')" == "${TRAVIS_TAG}" ] &&
[[ "${TRAVIS_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(([ab]|dev|rc)[0-9]+)?$ ]]
Copy link
Member

Choose a reason for hiding this comment

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

👍

@palnabarun
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2020
@yliaog
Copy link
Contributor

yliaog commented Mar 10, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabianvf, yliaog

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit cbf95cf into kubernetes-client:master Mar 10, 2020
@fabianvf
Copy link
Contributor Author

@roycaihw would you mind doing another test with these changes, just to make sure it all works in the travis environment? Tested it out locally but you never know

@roycaihw
Copy link
Member

@fabianvf I checked out the latest revision of the config: https://github.com/kubernetes-client/python/commits/travis-pypi-experiment and tagged a new release

verify-tag failed with ModuleNotFoundError: No module named 'urllib3':
https://travis-ci.org/kubernetes-client/python/jobs/660868889

@palnabarun
Copy link
Member

I think this is due to the package not being installed in the environment or some other dependency issue.

When I ran it locally in a fresh virtual environment based on 3.7, it gave me this

$ mkvirtualenv --python=/usr/bin/python3.7 py37-temp
Running virtualenv with interpreter /usr/bin/python3.7
Already using interpreter /usr/bin/python3.7
Using base prefix '/usr'
New python executable in /home/nabarun/.envs/py37-temp/bin/python3.7
Also creating executable in /home/nabarun/.envs/py37-temp/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /home/nabarun/.envs/py37-temp/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/nabarun/.envs/py37-temp/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/nabarun/.envs/py37-temp/bin/preactivate
virtualenvwrapper.user_scripts creating /home/nabarun/.envs/py37-temp/bin/postactivate
virtualenvwrapper.user_scripts creating /home/nabarun/.envs/py37-temp/bin/get_env_details

$ python -c 'import kubernetes ; print(kubernetes.__version__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/nabarun/c/kubernetes/kubernetes-client/python/kubernetes/__init__.py", line 19, in <module>
    import kubernetes.client
  File "/home/nabarun/c/kubernetes/kubernetes-client/python/kubernetes/client/__init__.py", line 20, in <module>
    from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi
  File "/home/nabarun/c/kubernetes/kubernetes-client/python/kubernetes/client/api/__init__.py", line 6, in <module>
    from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi
  File "/home/nabarun/c/kubernetes/kubernetes-client/python/kubernetes/client/api/admissionregistration_api.py", line 18, in <module>
    import six
ModuleNotFoundError: No module named 'six'

Getting the client version from scripts/constants.py is better since it does not depend on any other thing and kubernetes.__version__ is generated from scripts/constants.CLIENT_VERSION itself.

$ python -c 'from scripts.constants import CLIENT_VERSION; print(CLIENT_VERSION)'
11.0.0-snapshot

k8s-ci-robot added a commit that referenced this pull request Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants