Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/cli-v3/src/entryPoints/managed/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export class RunExecution {
throw new Error("prepareForExecution called after process was already created");
}

// Set the task run environment so canExecute returns true
this.currentTaskRunEnv = opts.taskRunEnv;

this.taskRunProcess = await this.taskRunProcessProvider.getProcess({
taskRunEnv: opts.taskRunEnv,
isWarmStart: true,
Expand Down Expand Up @@ -584,10 +587,15 @@ export class RunExecution {

const taskRunEnv = this.currentTaskRunEnv ?? envVars;

this.taskRunProcess = await this.taskRunProcessProvider.getProcess({
taskRunEnv: { ...taskRunEnv, TRIGGER_PROJECT_REF: execution.project.ref },
isWarmStart,
});
if (!this.taskRunProcess || this.taskRunProcess.isBeingKilled) {
this.sendDebugLog("getting new task run process", { runId: execution.run.id });
this.taskRunProcess = await this.taskRunProcessProvider.getProcess({
taskRunEnv: { ...taskRunEnv, TRIGGER_PROJECT_REF: execution.project.ref },
isWarmStart,
});
} else {
this.sendDebugLog("using prepared task run process", { runId: execution.run.id });
}

this.attachTaskRunProcessHandlers(this.taskRunProcess);

Expand Down