checkov icon indicating copy to clipboard operation
checkov copied to clipboard

feat(general): add env for dont check package update

Open isality opened this issue 1 year ago • 6 comments

User description

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Hello!

I am using checkov in private cloud. I don't want the program to check for updates on pypi.org. It's a small pach solves my problem. I hope this is a good solution, if not, please suggest your alternatives.

Fixes # (issue)

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] I have added tests that prove my feature, policy, or fix is effective and works
  • [x] New and existing tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

Generated description

Dear maintainer, below is a concise technical summary of the changes proposed in this PR:

Introduce an environment variable CKV_SKIP_PACKAGE_UPDATE_CHECK to allow users to skip package update checks in checkov. Modify the check_for_update function in version_manager.py to accept a new parameter skip_check and return early if the check is skipped. Update banner.py to utilize this new parameter when checking for updates. Add the new environment variable to env_vars_config.py for configuration.

TopicDetails
Banner Update Update banner.py to use the new skip check parameter when checking for updates.
Modified files (1)
  • checkov/common/util/banner.py
Latest Contributors(2)
EmailCommitDate
47212872+EmmaVinen@use...feat-general-allow-too...September 11, 2024
28880387+tsmithv11@use...docs-general-Switch-re...November 08, 2023
Update Check Logic Modify check_for_update to accept a skip check parameter and return early if set.
Modified files (1)
  • checkov/common/version_manager.py
Latest Contributors(2)
EmailCommitDate
[email protected]chore-update-CycloneDx...December 31, 2023
[email protected]add-version-checker-an...October 15, 2020
Env Var Addition Introduce an environment variable CKV_SKIP_PACKAGE_UPDATE_CHECK to control package update checks.
Modified files (1)
  • checkov/common/util/env_vars_config.py
Latest Contributors(2)
EmailCommitDate
49649760+lirshindalman...feat-general-Refactor-...July 21, 2024
57212002+ChanochShayne...feat-terraform-Support...May 29, 2024
This pull request is reviewed by Baz. Join @isality and the rest of your team on (Baz).

isality avatar Jan 31 '24 14:01 isality

Hi @isality , and thanks for the contribution! Out of curiosity, what would be the reason for that behaviour?

Saarett avatar Feb 05 '24 07:02 Saarett

@Saarett hello!

I use checkov in the cloud where there is no Internet access. If I understood you correctly.

isality avatar Feb 05 '24 07:02 isality

@Saarett Hello!

I'm sorry. Need i do something else? Keeping the branch up to date takes me a while.

isality avatar Feb 07 '24 11:02 isality

can someone help me with integration tests? i don't know what's going on in your CI.

i ran tests locally all 10 tests - passed

alex@alex:~/Work/dev/checkov/checkov$ pipenv run pytest integration_tests -k 'not api_key'
==================================================================== test session starts =====================================================================
platform linux -- Python 3.10.12, pytest-8.0.0, pluggy-1.4.0
rootdir: /home/alex/Work/dev/checkov/checkov
configfile: pyproject.toml
plugins: xdist-3.5.0
2 workers [10 items]    
..........                                                                                                                                             [100%]
===================================================================== 10 passed in 0.36s =====================================================================
alex@alex:~/Work/dev/checkov/checkov$ git branch -v
* feature/skip-update-check 772c88c8a Merge branch 'main' into feature/skip-update-checkale

isality avatar Feb 10 '24 14:02 isality

@isality You can merge the PR :)

pazbechor avatar Jul 30 '24 13:07 pazbechor

@pazbechor hello! i'm sorry, but i can not. "The base branch restricts merging to authorized users."

isality avatar Jul 30 '24 13:07 isality