Comparing version 0.0.25 to 0.0.26
'use strict' | ||
const q = require('workq') | ||
const debug = require('debug')('pipeline') | ||
const error = require('debug')('pipeline:error') | ||
@@ -28,2 +29,3 @@ const State = require('./state') | ||
this.errored = false | ||
this.rollbacked = false | ||
this.error = null | ||
@@ -88,5 +90,10 @@ | ||
async rollback(err) { | ||
this.errored = true | ||
if (this.rollbacked) { | ||
debug(`Rollback already in progress %O`) | ||
return | ||
} | ||
this.rollbacked = true | ||
this.errored = !!err | ||
this.error = err | ||
for (let task of this.registry.tasks.reverse()) { | ||
@@ -200,3 +207,3 @@ // errors are suppressed so that each task can try to recover | ||
for (let task of this.registry.tasks) { | ||
if (this.errored) { | ||
if (this.rollbacked) { | ||
error('Abort Pipeline error %O', this.error) | ||
@@ -207,5 +214,4 @@ break | ||
this.queue.add(async child => { | ||
let state = new State(child, task, this) | ||
try { | ||
let state = new State(child, task, this) | ||
await this.executeTask(task, state) | ||
@@ -212,0 +218,0 @@ } catch (err) { |
@@ -57,2 +57,8 @@ 'use strict' | ||
const state = this | ||
if (this.pipeline.rollbacked) { | ||
error('Abort Pipeline error %O', this.error) | ||
return | ||
} | ||
this.pipeline.registry.addTask(task) | ||
@@ -74,3 +80,3 @@ | ||
this.queue.add(async child => { | ||
if (this.pipeline.errored) { | ||
if (this.pipeline.rollbacked) { | ||
debug( | ||
@@ -77,0 +83,0 @@ 'Task <%s:%s> cancel next Job due to (Job) error', |
{ | ||
"name": "bootme", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13248
588