@Override public void processCompletedPipelineExecution(Execution execution) { CanaryExecutionStatusResponse canaryExecutionStatusResponse = executionMapper.fromExecution(execution); CanaryExecutionCompletedEvent canaryExecutionCompletedEvent = new CanaryExecutionCompletedEvent(this, canaryExecutionStatusResponse); applicationEventPublisher.publishEvent(canaryExecutionCompletedEvent); } }
@ApiOperation(value = "Retrieve status and results for a canary run") @RequestMapping(value = "/{canaryExecutionId:.+}", method = RequestMethod.GET) public CanaryExecutionStatusResponse getCanaryResults(@RequestParam(required = false) final String storageAccountName, @PathVariable String canaryExecutionId) { String resolvedStorageAccountName = CredentialsHelper.resolveAccountByNameOrType(storageAccountName, AccountCredentials.Type.OBJECT_STORE, accountCredentialsRepository); Execution pipeline = executionRepository.retrieve(Execution.ExecutionType.PIPELINE, canaryExecutionId); return executionMapper.fromExecution(resolvedStorageAccountName, pipeline); }
public CanaryExecutionStatusResponse fromExecution(Execution pipeline) { String canaryExecutionId = pipeline.getId(); Stage contextStage = pipeline.getStages().stream() .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'")); Map<String, Object> contextContext = contextStage.getContext(); String storageAccountName = (String)contextContext.get("storageAccountName"); return fromExecution(storageAccountName, pipeline); }
.map(execution -> executionMapper.fromExecution(resolvedStorageAccountName, execution)) .collect(Collectors.toList());
CanaryExecutionStatusResponse statusResponse = executionMapper.fromExecution(resolvedStorageAccountName, pipeline);
@Override public void processCompletedPipelineExecution(Execution execution) { CanaryExecutionStatusResponse canaryExecutionStatusResponse = executionMapper.fromExecution(execution); CanaryExecutionCompletedEvent canaryExecutionCompletedEvent = new CanaryExecutionCompletedEvent(this, canaryExecutionStatusResponse); applicationEventPublisher.publishEvent(canaryExecutionCompletedEvent); } }
public CanaryExecutionStatusResponse fromExecution(Execution pipeline) { String canaryExecutionId = pipeline.getId(); Stage contextStage = pipeline.getStages().stream() .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'")); Map<String, Object> contextContext = contextStage.getContext(); String storageAccountName = (String)contextContext.get("storageAccountName"); return fromExecution(storageAccountName, pipeline); }
CanaryExecutionStatusResponse statusResponse = executionMapper.fromExecution(resolvedStorageAccountName, pipeline);