Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

whitesource-ps/ws-version-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

License GitHub release
Build and Publish Python 3.6

WhiteSource Version Checker

The script checks the WhiteSource tools , validates whether there is a new version and updates it accordingly.

Supported tools

How to use the script

  • Run it on your local machine where the tool is stored.
  • Run it as part of your CI process , prior to using one of the supported tools.

What does the script do?

The script checks the tool version in one of the following ways:

  1. Compares the local version file hash value (based on hashlib.algorithms_guaranteed) with the latest version from WhiteSource.
  2. Compares the local version file semantic versioning with the WhiteSource tool GitHub repo latest release link - for example - Unified Agent .

Supported Operating Systems

  • Linux (Bash): CentOS, Debian, Ubuntu, RedHat
  • Windows (PowerShell): 10, 2012, 2016

Prerequisites

  • Python 3.6 or above.
  • Java JDK 8 ,Java JDK 11 ( in favor of jarsigner ).

Installation

  1. Download and unzip ws-version-checker.zip.
  2. From the command line, navigate to the ws-version-checker directory and install the package:
    pip install -r requirements.txt.
  3. Edit the /version_check/params.config file and update the relevant parameters (see the configuration parameters below) or use a cmd line for running the /version_check/ws_version_checker.py script.

Configuration Parameters

=====================================================================================================================================================================================================
| config file         | cli                        | Environment Variables     | Default  | Optional values                   | Description                                                          |
=====================================================================================================================================================================================================
| fileDir             | -f,  --fileDir             | WSVC_FILE_DIR             |          |                                   | The file directory path.                                             |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| fileName            | -n,  --fileName            | WSVC_FILE_NAME            |          |                                   | The name of the file to be checked by the tool.                      |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| compareWithWsGit    | -g,  --compareWithWsGit    | WSVC_COMPARE_WITH_WS_GIT  | True     | True / False                      | If True -compared with git version ,if false use comparedHashMethod. |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| comparedHashMethod  | -m,  --comparedHashMethod  | WSVC_COMPARED_HASH_METHOD | md5      | See hashlib.algorithms_guaranteed | One of hashlib.algorithms_guaranteed to perform the hash compare.    |
=====================================================================================================================================================================================================

Execution

From the command line:

  • When compareWithWsGit = True python ws_version_checker.py -f $fileDir -n $fileName -g $compareWithWsGit
  • When compareWithWsGit = False python ws_version_checker.py -f $fileDir -n $fileName -g $compareWithWsGit -m $comparedHashMethod

Using a config file:

  • python ws_version_checker.py -c / --configFile <CONFIG_FILE>

Environment Variables:

  • A parameter name as defined in the configuration file converted to upper case with underscore (_) separators and WSVC_ prefix added.
  • For example the fileName parameter can be set using the WSVC_FILE_NAME environment variable.
  • If an environment variable exists , it will overwrite any value for the matching parmter in the command line / configuration file.

Author

WhiteSource Software ©

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages