diff --git a/packages/core/acme-client/src/api.js b/packages/core/acme-client/src/api.js index 60393164..9c251ca5 100644 --- a/packages/core/acme-client/src/api.js +++ b/packages/core/acme-client/src/api.js @@ -18,6 +18,21 @@ class AcmeApi { this.accountUrl = accountUrl; } + getLocationFromHeader(resp) { + let locationUrl = resp.headers.location; + const mapping = this.http.urlMapping; + if (mapping.mappings) { + // eslint-disable-next-line guard-for-in,no-restricted-syntax + for (const key in mapping.mappings) { + const url = mapping.mappings[key]; + if (locationUrl.indexOf(url) > -1) { + locationUrl = locationUrl.replace(url, key); + } + } + } + return locationUrl; + } + /** * Get account URL * @@ -104,17 +119,7 @@ class AcmeApi { /* Set account URL */ if (resp.headers.location) { - this.accountUrl = resp.headers.location; - const mapping = this.http.urlMapping; - if (mapping.mappings) { - // eslint-disable-next-line guard-for-in,no-restricted-syntax - for (const key in mapping.mappings) { - const url = mapping.mappings[key]; - if (this.accountUrl.indexOf(url) > -1) { - this.accountUrl = this.accountUrl.replace(url, key); - } - } - } + this.accountUrl = this.getLocationFromHeader(resp); } return resp; diff --git a/packages/core/acme-client/src/client.js b/packages/core/acme-client/src/client.js index f3cf2a70..f32cd17c 100644 --- a/packages/core/acme-client/src/client.js +++ b/packages/core/acme-client/src/client.js @@ -300,7 +300,8 @@ class AcmeClient { } /* Add URL to response */ - resp.data.url = resp.headers.location; + resp.data.url = this.api.getLocationFromHeader(resp); + return resp.data; } diff --git a/packages/core/pipeline/src/core/executor.ts b/packages/core/pipeline/src/core/executor.ts index bae5bd01..daba79ec 100644 --- a/packages/core/pipeline/src/core/executor.ts +++ b/packages/core/pipeline/src/core/executor.ts @@ -30,6 +30,7 @@ export class Executor { contextFactory: ContextFactory; logger: Logger; pipelineContext!: IContext; + currentStatusMap!: RunnableCollection; lastStatusMap!: RunnableCollection; lastRuntime!: RunHistory; options: ExecutorOptions; @@ -52,6 +53,7 @@ export class Executor { const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`); this.lastRuntime = lastRuntime; this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline); + this.currentStatusMap = new RunnableCollection(this.pipeline); } async cancel() { @@ -206,7 +208,7 @@ export class Executor { private async runStep(step: Step) { const currentLogger = this.runtime._loggers[step.id]; - + this.currentStatusMap.add(step); const lastStatus = this.lastStatusMap.get(step.id); //执行任务 const plugin: RegistryItem = pluginRegistry.get(step.type); @@ -224,7 +226,7 @@ export class Executor { const arr = contextKey.split("."); const id = arr[1]; const outputKey = arr[2]; - step.input[key] = this.lastStatusMap.get(id)?.status?.output[outputKey]; + step.input[key] = this.currentStatusMap.get(id)?.status?.output[outputKey] ?? this.lastStatusMap.get(id)?.status?.output[outputKey]; } } }); diff --git a/packages/core/pipeline/src/core/run-history.ts b/packages/core/pipeline/src/core/run-history.ts index ad27c5c3..8288a362 100644 --- a/packages/core/pipeline/src/core/run-history.ts +++ b/packages/core/pipeline/src/core/run-history.ts @@ -165,4 +165,8 @@ export class RunnableCollection { item.status = undefined; }); } + + add(runnable: Runnable) { + this.collection[runnable.id] = runnable; + } }