The script checks the WhiteSource tools , validates whether there is a new version and updates it accordingly.
- 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.
The script checks the tool version in one of the following ways:
- Compares the local version file hash value (based on hashlib.algorithms_guaranteed) with the latest version from WhiteSource.
- Compares the local version file semantic versioning with the WhiteSource tool GitHub repo latest release link - for example - Unified Agent .
- Linux (Bash): CentOS, Debian, Ubuntu, RedHat
- Windows (PowerShell): 10, 2012, 2016
- Python 3.6 or above.
- Java JDK 8 ,Java JDK 11 ( in favor of jarsigner ).
- Download and unzip ws-version-checker.zip.
- From the command line, navigate to the ws-version-checker directory and install the package:
pip install -r requirements.txt. - Edit the
/version_check/params.configfile and update the relevant parameters (see the configuration parameters below) or use a cmd line for running the/version_check/ws_version_checker.pyscript.
=====================================================================================================================================================================================================
| 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. |
=====================================================================================================================================================================================================
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
fileNameparameter can be set using theWSVC_FILE_NAMEenvironment variable. - If an environment variable exists , it will overwrite any value for the matching parmter in the command line / configuration file.
WhiteSource Software ©
