[version check] add a check for the environment variable INFERVERSION

Summary: Add a sanity check that looks up the `INFERVERSION` environment variable and, if set, checks that the current binary matches that version.

Reviewed By: skcho

Differential Revision: D16761575

fbshipit-source-id: 9d5c32220
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent 06d6363710
commit e272287377

@ -438,6 +438,8 @@ let infer_top_results_dir_env_var = "INFER_TOP_RESULTS_DIR"
let infer_inside_maven_env_var = "INFER_INSIDE_MAVEN"
let infer_version_env_var = "INFERVERSION"
let maven = CLOpt.is_env_var_set infer_inside_maven_env_var
let env_inside_maven = `Extend [(infer_inside_maven_env_var, "1")]

@ -103,6 +103,8 @@ val idempotent_getters : bool
val infer_py_argparse_error_exit_code : int
val infer_version_env_var : string
val initial_analysis_time : float
val ivar_attributes : string

@ -120,6 +120,12 @@ let () =
Version.versionString
| None ->
() ) ;
Sys.getenv Config.infer_version_env_var
|> Option.iter ~f:(fun version ->
if not (String.is_prefix version ~prefix:Version.commit) then
L.(die UserError)
"Version '%s' (in environment variable %s) does not match commit hash '%s'" version
Config.infer_version_env_var Version.commit ) ;
if Config.print_builtins then Builtin.print_and_exit () ;
setup () ;
log_environment_info () ;

Loading…
Cancel
Save