public PipelineConfiguration upgradeIfNecessary ( StageLibraryTask library , PipelineConfiguration pipelineConf , List < Issue > issues ) { Preconditions . checkArgument ( issues . isEmpty ( ) , "Given list of issues must be empty." ) ; boolean upgrade ; // Firstly upgrading schema if needed, then data upgrade = needsSchemaUpgrade ( pipelineConf , issues ) ; if ( upgrade && issues . isEmpty ( ) ) { pipelineConf = upgradeSchema ( library , pipelineConf , issues ) ; } // Something went wrong with the schema upgrade if ( ! issues . isEmpty ( ) ) { return null ; } // Upgrading data if needed upgrade = needsUpgrade ( library , pipelineConf , issues ) ; if ( upgrade && issues . isEmpty ( ) ) { //we try to upgrade only if we have all defs for the pipelineConf pipelineConf = upgrade ( library , pipelineConf , issues ) ; } return ( issues . isEmpty ( ) ) ? pipelineConf : null ; }
Upgrade whole pipeline at once and return updated variant .