Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (
event.blueocean_job_pipeline_name === this.pipelineName &&
event.jenkins_object_type === 'org.jenkinsci.plugins.workflow.job.WorkflowRun' &&
(event.job_run_status === 'ALLOCATED' ||
event.job_run_status === 'RUNNING' ||
event.job_run_status === 'SUCCESS' ||
event.job_run_status === 'FAILURE')
) {
// set pipeline details thats needed later on in BbCompleteStep.navigatePipeline()
this.pipeline = { organization: event.jenkins_org, fullName: this.pipelineName };
this._finishListening(STATE.STEP_COMPLETE_SUCCESS);
return;
}
if (event.job_multibranch_indexing_result) {
pipelineService
.fetchPipeline(event.blueocean_job_rest_url, { useCache: false })
.then(pipeline => {
if (!pipeline.branchNames.length && isSshRepositoryUrl(this.repositoryUrl)) {
this._finishListening(STATE.STEP_COMPLETE_MISSING_JENKINSFILE);
} else {
this._finishListening(STATE.STEP_COMPLETE_SUCCESS);
}
})
.catch(() => {
this._finishListening(STATE.STEP_COMPLETE_EVENT_ERROR);
});
}
}
}
loadPipelineMetadata() {
const { organization, pipeline } = this.props.params;
const split = pipeline.split('/');
const team = split[0];
this.href = Paths.rest.pipeline(organization, team);
return pipelineService
.fetchPipeline(this.href, { useCache: true })
.then(pipeline => this._savePipelineMetadata(pipeline))
.catch(err => {
this.showErrorDialog(err);
});
}
_loadPipeline() {
const { pipeline } = this.props;
const folder = pipeline.fullName.split('/')[0];
const href = Paths.rest.apiRoot() + '/organizations/' + pipeline.organization + '/pipelines/' + folder + '/';
pipelineService.fetchPipeline(href, { useCache: true, disableCapabilities: false }).then(pipeline => {
if (this._canSavePipeline(pipeline)) {
this.setState({ supportsSave: true });
}
});
}