public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) {
        BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO);
        if (buildInfo == null) {
            buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap());
            stepVariables.put(BUILD_INFO, buildInfo);
        }
        buildInfo.setCpsScript(cpsScript);
        return buildInfo;
    }
public static BuildInfo appendBuildInfo ( CpsScript cpsScript , Map < String , Object > stepVariables ) { BuildInfo buildInfo = ( BuildInfo ) stepVariables . get ( BUILD_INFO ) ; if ( buildInfo == null ) { buildInfo = ( BuildInfo ) cpsScript . invokeMethod ( "newBuildInfo" , Maps . newLinkedHashMap ( ) ) ; stepVariables . put ( BUILD_INFO , buildInfo ) ; } buildInfo . setCpsScript ( cpsScript ) ; return buildInfo ; }
Add the buildInfo to step variables if missing and set its cps script.

@param cpsScript     the cps script
@param stepVariables step variables map
@return the build info