function transformExecution()

in app/scripts/modules/core/delivery/service/executions.transformer.service.js [19:92]


    function transformExecution(application, execution) {

      if (execution.trigger) {
        execution.isStrategy = execution.trigger.isPipeline === false && execution.trigger.type === 'pipeline';
      }
      applyPhasesAndLink(execution);
      pipelineConfig.getExecutionTransformers().forEach(function(transformer) {
        transformer.transform(application, execution);
      });
      var stageSummaries = [];

      execution.context = execution.context || {};
      execution.stages.forEach(function(stage, index) {
        stage.before = stage.before || [];
        stage.after = stage.after || [];
        stage.index = index;
        orchestratedItemTransformer.defineProperties(stage);
        if (stage.tasks && stage.tasks.length) {
          stage.tasks.forEach(t => orchestratedItemTransformer.addRunningTime(t));
        }
      });

      execution.stages.forEach(function(stage) {
        let context = stage.context || {};
        var owner = stage.syntheticStageOwner;
        var parent = _.find(execution.stages, { id: stage.parentStageId });
        if (parent) {
          if (owner === 'STAGE_BEFORE') {
            parent.before.push(stage);
          }
          if (owner === 'STAGE_AFTER') {
            parent.after.push(stage);
          }
        }
        stage.cloudProvider = context.cloudProvider || context.cloudProviderType;
      });

      execution.stages.forEach(function(stage) {
        if (!stage.syntheticStageOwner && !hiddenStageTypes.includes(stage.type)) {
          // HACK: Orca sometimes (always?) incorrectly reports a parent stage as running when a child stage has stopped
          if (stage.status === 'RUNNING' && stage.after.some(s => s.status === 'STOPPED')) {
            stage.status = 'STOPPED';
          }
          let context = stage.context || {};
          stageSummaries.push({
            name: stage.name,
            id: stage.id,
            startTime: stage.startTime,
            endTime: stage.endTime,
            masterStage: stage,
            type: stage.type,
            before: stage.before,
            after: stage.after,
            status: stage.status,
            comments: context.comments || null,
            cloudProvider: stage.cloudProvider,
            refId: stage.refId,
            requisiteStageRefIds: stage.requisiteStageRefIds && stage.requisiteStageRefIds[0] === '*' ? [] : stage.requisiteStageRefIds || [],
          });
        }
      });

      orchestratedItemTransformer.defineProperties(execution);

      stageSummaries.forEach(transformStageSummary);
      execution.stageSummaries = stageSummaries;
      execution.currentStages = getCurrentStages(execution);
      addStageWidths(execution);
      addBuildInfo(execution);
      addDeploymentTargets(execution);
      //let end = window.performance.now();
      //totalTime += (end-start);
      //console.warn('tt:', totalTime, '(this)', (end-start));
    }