Example #1
0
 .then(logs => {
     const updatedMetaData = {logs: logs, finishedAt: new Date()};
     phaseMetadata.state = onState;
     phaseMetadata[phaseName] = Object.assign(phaseMetadata[phaseName], updatedMetaData);
     return Build.findOneAndUpdate({_id: build._id}, phaseMetadata, {new: true}).exec()
                 .then(() => kubeClient.deletePod(phasePod));
 });
Example #2
0
const _runPipelinePhase = (PodBuilder, podArgs, phaseName, build) => {
    const phaseMetadata = {state: 'Running'};
    phaseMetadata[phaseName] = {};
    phaseMetadata[phaseName].startedAt = new Date();

    return Build.findOneAndUpdate({_id: build._id}, phaseMetadata, {new: true}).exec()
        .then(() => PodBuilder.createPod(podArgs))
        .then(pod => {
            phaseMetadata[phaseName].podName = pod.metadata.name;
            return Build.findOneAndUpdate({_id: build._id}, phaseMetadata, {new: true}).exec()
                        .return(pod);
        })
        .then(pod => kubeClient.streamPodUntilPhase(pod))
        .catch({name: 'PodStreamError'}, e => _endPipelinePhase(phaseName, e.pod, build, phaseMetadata, 'Failed'))
        .then(pod => _endPipelinePhase(phaseName, pod, build, phaseMetadata, 'Success'));
};
Example #3
0
 .then(() => Build.count({}).exec().then(count => expect(count).toBeGreaterThan(1)));
Example #4
0
 .then(branch => {
     buildData.branch = branch._id;
     console.log('Upserting Build');
     return Build.upsert(buildData, buildData)
         .catch(err => console.error(`Could not upsert build: ${err}`));
 })
Example #5
0
 .then(pod => {
     phaseMetadata[phaseName].podName = pod.metadata.name;
     return Build.findOneAndUpdate({_id: build._id}, phaseMetadata, {new: true}).exec()
                 .return(pod);
 })