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

Created a new query and lint rule for gke serial port logging org policy-issue#30 #106

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

kaushik853
Copy link
Contributor

To identify when the constraints/compute.disableSerialPortLogging policy is enabled using the orgpolicy.py file, follow these steps:

The PREFETCH_ORG_CONSTRAINTS tuple in the orgpolicy.py file includes the constraints/compute.disableSerialPortLogging policy.
The _get_effective_org_policy_all_constraints function fetches all constraints listed in PREFETCH_ORG_CONSTRAINTS for a given project.
The get_effective_org_policy function retrieves the effective organization policy for a specific constraint by calling _get_effective_org_policy_all_constraints and checking if the constraint is enforced.
The BooleanPolicyConstraint class has an is_enforced method that returns whether the policy is enforced.
I modified the gke.py file in queries and added a new lint rule/err file and created a documentation under website folder.

@kaushik853
Copy link
Contributor Author

kaushik853 commented Jan 3, 2025

@ebenezergraham python3.12 version doesnt have distutils in standard library, either downgrade python version or pip install setuptools.
https://peps.python.org/pep-0632/

@kaushik853
Copy link
Contributor Author

@schweikert can you suggest something for this

Copy link
Contributor

@eugenenuke eugenenuke left a comment

Choose a reason for hiding this comment

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

Hey, thanks for contributing to the project.

In general everything looks good, we just need to polish it in some places.

@@ -461,6 +478,51 @@ def cluster_hash(self) -> Optional[str]:
return self._resource_data['id'][:8]
raise UndefinedClusterPropertyError('no id')

def check_serial_port_logging_policy(self) -> Optional[bool]:
Copy link
Contributor

Choose a reason for hiding this comment

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

this file doesn't look like a good place for this function/check: orgpolicies don't belong to GKE and I don't see how it can be re-used by other modules.

I suggest moving the logic to err_2025_001_serial_port_logging.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will move this function to err_2025_001_serial_port_logging.py

logging.error(f"Error checking serial port logging policy: {e}")
return None

def is_serial_port_logging_compliant(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as for check_serial_port_logging_policy()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will move this function to err_2025_001_serial_port_logging.py

website/content/en/rules/gke/ERR/2025_001.md Outdated Show resolved Hide resolved
# limitations under the License.

# Lint as: python3
"""GKE clusters must comply with serial port logging policy.
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 should define a good/target state, e.g. GKE cluster complies with the serial port logging organization policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

modified the text.

Copy link
Contributor

Choose a reason for hiding this comment

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

pls use here the same text as in 2025_001.md: GKE cluster complies with the serial port logging organization policy.


When the constraints/compute.disableSerialPortLogging policy is enabled,
GKE clusters must be created with logging disabled (serial-port-logging-enable: 'false'),
otherwise the creation will fail.
Copy link
Contributor

Choose a reason for hiding this comment

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

we just need clarify creation of what: new nodes in nodepools

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added these in the comments.

report.add_failed(
cluster,
msg=
('Cluster does not comply with serial port logging policy. '
Copy link
Contributor

Choose a reason for hiding this comment

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

the message from line 18 will be displayed for this section during execution, why printing this message for every cluster? what if I have 100+ clusters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eugenenuke Do you suggest to remove the msg and remediation part here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, correct

'Update the node pool metadata to set '
'"serial-port-logging-enable": "false" for all node pools'))

except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

what exception are you expecting here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

couple of exceptions like key/value error, if error accessing policy or metadata. Error with google api. i can probably add them more explicitly @eugenenuke let me know ?

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can see, the only call that triggers an API is gke.get_clusters() and it's out of this try/except block (note that it has its own block)

Other function calls look safe enough to omit try/except completely.

Copy link
Contributor

Choose a reason for hiding this comment

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

to make it 100% clear: we don't need try/except here

gcpdiag/lint/gke/err_2025_001_serial_port_logging.py Outdated Show resolved Hide resolved
website/content/en/rules/gke/ERR/2025_001.md Show resolved Hide resolved
gcpdiag/lint/gke/err_2025_001_serial_port_logging.py Outdated Show resolved Hide resolved
@kaushik853
Copy link
Contributor Author

Hey, thanks for contributing to the project.

In general everything looks good, we just need to polish it in some places.

Thanks Evgenii, I will make the required changes

@kaushik853
Copy link
Contributor Author

@eugenenuke i added the requested change.

weight: 1
type: docs
description: >
GKE clusters complies with the serial port logging organization policy.
Copy link
Contributor

Choose a reason for hiding this comment

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

clusters - > cluster

# limitations under the License.

# Lint as: python3
"""GKE clusters must comply with serial port logging policy.
Copy link
Contributor

Choose a reason for hiding this comment

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

pls use here the same text as in 2025_001.md: GKE cluster complies with the serial port logging organization policy.

continue

# Check if cluster complies with serial port logging policy
if is_serial_port_logging_compliant(cluster):
Copy link
Contributor

Choose a reason for hiding this comment

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

true/false return value provides us only per-cluster granularity, this might be too coarse

if we have some big number of nodepools (e.g. dozens) in a cluster and only a few of them have a conflicting logging configuration, would it be easy for a user to fix the problem? In the current state we expect them to figure out the list of affected pools by themselves.

if we get a list of "affected" nodepools, we can display it within "add_failed", e,g:report.add_failed(cluster, "The following nodepools don't comply with the serial port logging org policy: <list of np>")

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eugenenuke ok good idea. let me see how i can capture the nodepool name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eugenenuke ok good idea. let me see how i can capture the nodepool name

Ok, i added the new way to capture the nodepool name.

1) gcloud container clusters create example-cluster \
--metadata serial-port-logging-enable=false
2) gcloud container node-pools create node-pool-1 \
--cluster=example-cluster --metadata serial-port-logging-enable=false
Copy link
Contributor

Choose a reason for hiding this comment

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

This text seems to be closer to "Description" than "Remediation". We'd better explicitly tell what needs to be done.

Essentially, there are 3 options to remediate the issue that we need to cover:

  • disable the org policy
  • recreate all non-compliant node pools
  • recreate all non-compliant clusters

Pls add some more details for each of the option and provide a link to a public page that explains how to do that, e.g.:

return None
except Exception as e:
logging.error(f"Error checking serial port logging policy: {e}")
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I would ignore try/except here, but as return None causes an issue, I'm highlighting it again:

  • do we really need try/except? (hint: no)
  • we need to do all logging through report.add_ (hint: no "logging.error()" in a lint rule)
  • what happens if at line 82, where two values are expected, we get None? (hint: the return value should be the same type)

PS: is_serial_port_logging_compliant() seems to be redundant, it only wraps the response from check_serial_port_logging_policy(). why don't we keep check_serial_port_logging_policy() only?

PPS: do we really need a dedicated is_compliant variable? If we just return a list of noncompliant pools, that should be enough data to work with and there will be only one return value. In this case, I'd rename check_serial_port_logging_policy() to something like get_noncompliant_pools()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok , so we dont need the status true/false as such anyway

for nodepool in cluster.nodepools:
# Check if serial port logging is disabled in node config metadata
metadata = nodepool.config.metadata or {}
serial_logging_enabled = metadata.get('serial-port-logging-enable',
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the ideal candidate to move under main/gcpdiag/queries/gke.py.

  @property
  def is_serial_logging_enabled(self) -> bool:
    return ...

@@ -61,6 +61,10 @@ def image_type(self) -> str:
def oauth_scopes(self) -> list:
return self._resource_data['oauthScopes']

@property
def metadata(self) -> dict:
return self._resource_data.get('metadata', {})
Copy link
Contributor

Choose a reason for hiding this comment

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

replace with

  @property
  def is_serial_logging_enabled(self) -> bool:
    return ...

moved the serial port logic to gke.py file.
refactor the err file to give only non compliant pools.
@kaushik853
Copy link
Contributor Author

@eugenenuke moved the required logic and adjusted the run rule.

Copy link
Contributor

@eugenenuke eugenenuke left a comment

Choose a reason for hiding this comment

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

All looks good now. Thanks!

@eugenenuke
Copy link
Contributor

@kaushik853 pls make sure all the pre-commit tests pass

@kaushik853
Copy link
Contributor Author

@eugenenuke can you suggest where the pre commit is failing now ? some linting? pylint

@eugenenuke
Copy link
Contributor

Details

Pre-commits:

  • fix end of files.............................................................Failed
  • isort........................................................................Failed
  • gcpdiag/lint/gke/err_2025_001_serial_port_logging.py:78:0: C0301: Line too long (124/100) (line-too-long)
  • gcpdiag/lint/gke/err_2025_001_serial_port_logging.py:23:0: W0611: Unused import logging (unused-import)

First is to make sure that there is no empty line at the end of *.py and *.md files
Second is to sort imports according to our rules.
Others are self-explanatory.

To fix the first two, you can run pre-commit run --all-files and add the changes to the commit.

Make-test:

  • FAILED gcpdiag/lint/gke/gke_rules_snapshot_test.py::Test::test_all_rules

you need to run "make snapshots" command from the repo root directory, add the generated file(s) to the commit and push the changes

@kaushik853
Copy link
Contributor Author

@eugenenuke the pre-commit always end with error Traceback (most recent call last): File "/Library/Python/3.8/site-packages/pre_commit/error_handler.py", line 73, in error_handler yield File "/Library/Python/3.8/site-packages/pre_commit/main.py", line 414, in main return run(args.config, store, args) File "/Library/Python/3.8/site-packages/pre_commit/commands/run.py", line 442, in run install_hook_envs(to_install, store) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 248, in install_hook_envs _hook_install(hook) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 95, in _hook_install lang.install_environment( File "/Library/Python/3.8/site-packages/pre_commit/languages/python.py", line 214, in install_environment lang_base.setup_cmd(prefix, install_cmd) File "/Library/Python/3.8/site-packages/pre_commit/lang_base.py", line 86, in setup_cmd cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs) File "/Library/Python/3.8/site-packages/pre_commit/util.py", line 110, in cmd_output_b raise CalledProcessError(returncode, cmd, stdout_b, stderr_b) pre_commit.util.CalledProcessError: command: ('/Users/kaushikpal/.cache/pre-commit/repot7rbpunl/py_env-python3/bin/python', '-mpip', 'install', '.') return code: 1 stdout: Processing /Users/kaushikpal/.cache/pre-commit/repot7rbpunl Installing build dependencies: started Installing build dependencies: still running... Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting platformdirs>=2.2.0 (from pylint==3.3.1) Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB) INFO: pip is looking at multiple versions of pylint to determine which version is compatible with other requirements. This could take a while. stderr: ERROR: Ignored the following yanked versions: 2.13.0, 2.13.1 ERROR: Ignored the following versions that require a different python version: 3.3.0 Requires-Python >=3.9.0; 3.3.1 Requires-Python >=3.9.0; 3.3.2 Requires-Python >=3.9.0; 3.3.3 Requires-Python >=3.9.0; 3.3.4 Requires-Python >=3.9.0; 3.3.5 Requires-Python >=3.9.0; 3.3.6 Requires-Python >=3.9.0; 3.3.7 Requires-Python >=3.9.0; 3.3.8 Requires-Python >=3.9.0 ERROR: Could not find a version that satisfies the requirement astroid<=3.4.0-dev0,>=3.3.4 (from pylint) (from versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 2.0.0.dev0, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0.dev0, 2.1.0, 2.2.0.dev0, 2.2.0.dev1, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.6.0.dev0, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.8.0, 2.8.1, 2.8.2.dev0, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5, 2.11.6, 2.11.7, 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.12.4, 2.12.5, 2.12.6, 2.12.7, 2.12.8, 2.12.9, 2.12.10, 2.12.11, 2.12.12, 2.12.13, 2.12.14, 2.13.2, 2.13.3, 2.13.4, 2.13.5, 2.14.0, 2.14.1, 2.14.2, 2.15.0, 2.15.1, 2.15.2, 2.15.3, 2.15.4, 2.15.5, 2.15.6, 2.15.7, 2.15.8, 3.0.0a1, 3.0.0a2, 3.0.0a3, 3.0.0a4, 3.0.0a5, 3.0.0a6, 3.0.0a7, 3.0.0a8, 3.0.0a9, 3.0.0b0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4) ERROR: No matching distribution found for astroid<=3.4.0-dev0,>=3.3.4

@kaushik853
Copy link
Contributor Author

@eugenenuke the pre-commit always end with error Traceback (most recent call last): File "/Library/Python/3.8/site-packages/pre_commit/error_handler.py", line 73, in error_handler yield File "/Library/Python/3.8/site-packages/pre_commit/main.py", line 414, in main return run(args.config, store, args) File "/Library/Python/3.8/site-packages/pre_commit/commands/run.py", line 442, in run install_hook_envs(to_install, store) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 248, in install_hook_envs _hook_install(hook) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 95, in _hook_install lang.install_environment( File "/Library/Python/3.8/site-packages/pre_commit/languages/python.py", line 214, in install_environment lang_base.setup_cmd(prefix, install_cmd) File "/Library/Python/3.8/site-packages/pre_commit/lang_base.py", line 86, in setup_cmd cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs) File "/Library/Python/3.8/site-packages/pre_commit/util.py", line 110, in cmd_output_b raise CalledProcessError(returncode, cmd, stdout_b, stderr_b) pre_commit.util.CalledProcessError: command: ('/Users/kaushikpal/.cache/pre-commit/repot7rbpunl/py_env-python3/bin/python', '-mpip', 'install', '.') return code: 1 stdout: Processing /Users/kaushikpal/.cache/pre-commit/repot7rbpunl Installing build dependencies: started Installing build dependencies: still running... Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting platformdirs>=2.2.0 (from pylint==3.3.1) Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB) INFO: pip is looking at multiple versions of pylint to determine which version is compatible with other requirements. This could take a while. stderr: ERROR: Ignored the following yanked versions: 2.13.0, 2.13.1 ERROR: Ignored the following versions that require a different python version: 3.3.0 Requires-Python >=3.9.0; 3.3.1 Requires-Python >=3.9.0; 3.3.2 Requires-Python >=3.9.0; 3.3.3 Requires-Python >=3.9.0; 3.3.4 Requires-Python >=3.9.0; 3.3.5 Requires-Python >=3.9.0; 3.3.6 Requires-Python >=3.9.0; 3.3.7 Requires-Python >=3.9.0; 3.3.8 Requires-Python >=3.9.0 ERROR: Could not find a version that satisfies the requirement astroid<=3.4.0-dev0,>=3.3.4 (from pylint) (from versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 2.0.0.dev0, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0.dev0, 2.1.0, 2.2.0.dev0, 2.2.0.dev1, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.6.0.dev0, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.8.0, 2.8.1, 2.8.2.dev0, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5, 2.11.6, 2.11.7, 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.12.4, 2.12.5, 2.12.6, 2.12.7, 2.12.8, 2.12.9, 2.12.10, 2.12.11, 2.12.12, 2.12.13, 2.12.14, 2.13.2, 2.13.3, 2.13.4, 2.13.5, 2.14.0, 2.14.1, 2.14.2, 2.15.0, 2.15.1, 2.15.2, 2.15.3, 2.15.4, 2.15.5, 2.15.6, 2.15.7, 2.15.8, 3.0.0a1, 3.0.0a2, 3.0.0a3, 3.0.0a4, 3.0.0a5, 3.0.0a6, 3.0.0a7, 3.0.0a8, 3.0.0a9, 3.0.0b0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4) ERROR: No matching distribution found for astroid<=3.4.0-dev0,>=3.3.4

It seems to come from pylint. am i allowed to change the pylint version in .pre-commit-config.yaml file.

@kaushik853
Copy link
Contributor Author

kaushik853 commented Jan 25, 2025

@eugenenuke the pre-commit always end with error Traceback (most recent call last): File "/Library/Python/3.8/site-packages/pre_commit/error_handler.py", line 73, in error_handler yield File "/Library/Python/3.8/site-packages/pre_commit/main.py", line 414, in main return run(args.config, store, args) File "/Library/Python/3.8/site-packages/pre_commit/commands/run.py", line 442, in run install_hook_envs(to_install, store) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 248, in install_hook_envs _hook_install(hook) File "/Library/Python/3.8/site-packages/pre_commit/repository.py", line 95, in _hook_install lang.install_environment( File "/Library/Python/3.8/site-packages/pre_commit/languages/python.py", line 214, in install_environment lang_base.setup_cmd(prefix, install_cmd) File "/Library/Python/3.8/site-packages/pre_commit/lang_base.py", line 86, in setup_cmd cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs) File "/Library/Python/3.8/site-packages/pre_commit/util.py", line 110, in cmd_output_b raise CalledProcessError(returncode, cmd, stdout_b, stderr_b) pre_commit.util.CalledProcessError: command: ('/Users/kaushikpal/.cache/pre-commit/repot7rbpunl/py_env-python3/bin/python', '-mpip', 'install', '.') return code: 1 stdout: Processing /Users/kaushikpal/.cache/pre-commit/repot7rbpunl Installing build dependencies: started Installing build dependencies: still running... Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting platformdirs>=2.2.0 (from pylint==3.3.1) Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB) INFO: pip is looking at multiple versions of pylint to determine which version is compatible with other requirements. This could take a while. stderr: ERROR: Ignored the following yanked versions: 2.13.0, 2.13.1 ERROR: Ignored the following versions that require a different python version: 3.3.0 Requires-Python >=3.9.0; 3.3.1 Requires-Python >=3.9.0; 3.3.2 Requires-Python >=3.9.0; 3.3.3 Requires-Python >=3.9.0; 3.3.4 Requires-Python >=3.9.0; 3.3.5 Requires-Python >=3.9.0; 3.3.6 Requires-Python >=3.9.0; 3.3.7 Requires-Python >=3.9.0; 3.3.8 Requires-Python >=3.9.0 ERROR: Could not find a version that satisfies the requirement astroid<=3.4.0-dev0,>=3.3.4 (from pylint) (from versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 2.0.0.dev0, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0.dev0, 2.1.0, 2.2.0.dev0, 2.2.0.dev1, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.6.0.dev0, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.8.0, 2.8.1, 2.8.2.dev0, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5, 2.11.6, 2.11.7, 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.12.4, 2.12.5, 2.12.6, 2.12.7, 2.12.8, 2.12.9, 2.12.10, 2.12.11, 2.12.12, 2.12.13, 2.12.14, 2.13.2, 2.13.3, 2.13.4, 2.13.5, 2.14.0, 2.14.1, 2.14.2, 2.15.0, 2.15.1, 2.15.2, 2.15.3, 2.15.4, 2.15.5, 2.15.6, 2.15.7, 2.15.8, 3.0.0a1, 3.0.0a2, 3.0.0a3, 3.0.0a4, 3.0.0a5, 3.0.0a6, 3.0.0a7, 3.0.0a8, 3.0.0a9, 3.0.0b0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4) ERROR: No matching distribution found for astroid<=3.4.0-dev0,>=3.3.4

It seems to come from pylint. am i allowed to change the pylint version in .pre-commit-config.yaml file.

My python version in virtualenv is 3.12.8

@kaushik853
Copy link
Contributor Author

If not i give a try with github codespace here if it improves the pylint problem

@kaushik853
Copy link
Contributor Author

not sure what the, i have both pylint and astroid installed with correct versionspip freeze | grep pylint pylint==3.3.1 (venv) kaushikpal@kaushiks-MacBook-Air gcpdiag % pip freeze | grep astroid astroid==3.3.5

@kaushik853
Copy link
Contributor Author

not sure what the, i have both pylint and astroid installed with correct versionspip freeze | grep pylint pylint==3.3.1 (venv) kaushikpal@kaushiks-MacBook-Air gcpdiag % pip freeze | grep astroid astroid==3.3.5

@eugenenuke the pylint version as per the pre-commit yaml is 3.3.1, which uninstall other astroid version and installs astroid 3.3.8. and im getting this error of uncompatible astrod version. Is thise some upstream error ?

1 similar comment
@kaushik853
Copy link
Contributor Author

not sure what the, i have both pylint and astroid installed with correct versionspip freeze | grep pylint pylint==3.3.1 (venv) kaushikpal@kaushiks-MacBook-Air gcpdiag % pip freeze | grep astroid astroid==3.3.5

@eugenenuke the pylint version as per the pre-commit yaml is 3.3.1, which uninstall other astroid version and installs astroid 3.3.8. and im getting this error of uncompatible astrod version. Is thise some upstream error ?

@kaushik853
Copy link
Contributor Author

these checks are all passing locally pre-commit run pylint --files gcpdiag/lint/gke/err_2025_001_serial_port_logging.py pylint...................................................................Passed (venv) kaushikpal@kaushiks-MacBook-Air gcpdiag % pre-commit run mypy --all-files mypy.....................................................................Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants