Skip to content
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

fix flake8 errors in Kubespray CI - tox-inventory-builder #6910

Merged
merged 4 commits into from
Nov 23, 2020

Conversation

hafe
Copy link
Contributor

@hafe hafe commented Nov 15, 2020

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug

/kind cleanup

/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

Kubespray CI - tox-inventory-builder no longer works

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 15, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @hafe. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 15, 2020
@oomichi
Copy link
Contributor

oomichi commented Nov 16, 2020

For example, https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/849333077 shows the following error:

pep8 run-test: commands[0] | bash -c 'find /builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/* -type f -name '"'"'*.py'"'"' -print0 | xargs -0 flake8'
/builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/tests/test_inventory.py:54:13: H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents.
            self.assertTrue(group in self.inv.yaml_config['all']['children'])
            ^
/builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/tests/test_inventory.py:230:9: H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents.
        self.assertTrue(
        ^
/builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/tests/test_inventory.py:249:13: H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents.
            self.assertTrue(
            ^
/builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/tests/test_inventory.py:258:9: H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents.
        self.assertTrue(
        ^
/builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/tests/test_inventory.py:266:9: H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents.
        self.assertTrue(
        ^
ERROR: InvocationError for command /bin/bash -c 'find /builds/kargo-ci/kubernetes-sigs-kubespray/contrib/inventory_builder/* -type f -name '"'"'*.py'"'"' -print0 | xargs -0 flake8' (exited with code 123)

Nice fixing.

/lgtm

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

oomichi commented Nov 16, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 16, 2020
@hafe
Copy link
Contributor Author

hafe commented Nov 16, 2020

/retest

Copy link
Contributor

@electrocucaracha electrocucaracha left a comment

Choose a reason for hiding this comment

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

Few suggestions

Comment on lines 53 to +54
for group in groups:
self.assertTrue(group in self.inv.yaml_config['all']['children'])
self.assertIn(group, self.inv.yaml_config['all']['children'])
Copy link
Contributor

Choose a reason for hiding this comment

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

What about something that doesn't iterate over the groups like:

self.assertTrue(set(groups).issuperset(set(self.inv.yaml_config['all']['children'])))

self.assertTrue(
bad_host not in self.inv.yaml_config['all']['hosts'].keys())
self.assertNotIn(
bad_host, self.inv.yaml_config['all']['hosts'].keys())
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 that this works without having to specify the keys() method

Suggested change
bad_host, self.inv.yaml_config['all']['hosts'].keys())
bad_host, self.inv.yaml_config['all']['hosts'])

@@ -246,25 +246,25 @@ def test_set_k8s_cluster(self):

self.inv.set_k8s_cluster()
for host in expected_hosts:
self.assertTrue(
host in
self.assertIn(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same suggestion as the first comment

self.assertTrue(set(expected_hosts).issuperset(self.inv.yaml_config['all']['children'][group]['children']))

@hafe
Copy link
Contributor Author

hafe commented Nov 16, 2020

Few suggestions

I just changed what was suggested in ci. I don't even have a clue what this piece of code is there for...

@hafe
Copy link
Contributor Author

hafe commented Nov 16, 2020

/retest

@oomichi
Copy link
Contributor

oomichi commented Nov 16, 2020

I just changed what was suggested in ci. I don't even have a clue what this piece of code is there for...

Yeah I agree with @hafe here.
It is better to concentrate on how to fix the CI issue based on the error messages at this time.

@hafe
Copy link
Contributor Author

hafe commented Nov 17, 2020

/retest

@hafe hafe force-pushed the fix-tox-inventory-builder branch from dfbea02 to ec9dba8 Compare November 18, 2020 10:01
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2020
@hafe hafe force-pushed the fix-tox-inventory-builder branch from ec9dba8 to 8b50326 Compare November 18, 2020 11:31
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 18, 2020
@hafe hafe force-pushed the fix-tox-inventory-builder branch from 8b50326 to 5d0b568 Compare November 18, 2020 13:08
@hafe hafe force-pushed the fix-tox-inventory-builder branch from 5d0b568 to c548706 Compare November 18, 2020 15:22
@k8s-ci-robot k8s-ci-robot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 18, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 21, 2020
@hafe
Copy link
Contributor Author

hafe commented Nov 21, 2020

/retest

@k8s-ci-robot
Copy link
Contributor

@bmelbourne: The /retest command does not accept any targets.
The following commands are available to trigger jobs:

  • /test pull-kubespray-yamllint

Use /test all to run all jobs.

In response to this:

/retest tf-ovh_ubuntu18-calico

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

@bmelbourne: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-kubespray-yamllint

Use /test all to run all jobs.

In response to this:

/test tf-ovh_ubuntu18-calico

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bmelbourne
Copy link
Contributor

/retest

@bmelbourne
Copy link
Contributor

/lgtm
/approve

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

oomichi commented Nov 23, 2020

/lgtm

Copy link
Member

@floryut floryut left a comment

Choose a reason for hiding this comment

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

At last 👍
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bmelbourne, floryut, hafe

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 Nov 23, 2020
@k8s-ci-robot k8s-ci-robot merged commit ee23b94 into kubernetes-sigs:master Nov 23, 2020
@champtar champtar mentioned this pull request Dec 11, 2020
@RickHaan RickHaan mentioned this pull request Jan 8, 2021
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jan 16, 2021
…-sigs#6910)

* fix flake8 errors in Kubespray CI - tox-inventory-builder

* Invalidate CRI-O kubic repo's cache

Signed-off-by: Victor Morales <[email protected]>

* add support to configure pkg install retries

and use in CI job tf-ovh_ubuntu18-calico (due to it failing often)

* Switch Calico, Cilium and MetalLB image repos to Quay.io

Co-authored-by: Victor Morales <[email protected]>
Co-authored-by: Barry Melbourne <[email protected]>
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

6 participants