Fix build failure due to missing environment vars
Fix build failure due to missing environment vars

Also consolidate duplicate functionality into a function

Change-Id: I32f2cd916200a3c4bd5b2e4e1e6412af7b57d5e0

instructure/academic_benchmarks,instructure/academic_benchmarks