Skip to content

Commit

Permalink
fix(worker): overwrite value each time (#4903)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and richardlt committed Jan 20, 2020
1 parent dab0aa8 commit 1bf3c5d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions engine/worker/internal/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ func (w *CurrentWorker) runJob(ctx context.Context, a *sdk.Action, jobID int64,
// Check if all newVariables are in currentJob.params
// variable can be add in w.currentJob.newVariables by worker command export
for _, newVariableFromHandler := range w.currentJob.newVariables {
if sdk.ParameterFind(w.currentJob.params, newVariableFromHandler.Name) == nil {
p := sdk.ParameterFind(w.currentJob.params, newVariableFromHandler.Name)
if p == nil {
w.currentJob.params = append(w.currentJob.params, newVariableFromHandler.ToParameter(""))
} else {
p.Value = newVariableFromHandler.Value
}
}

Expand Down Expand Up @@ -270,8 +273,11 @@ func (w *CurrentWorker) runSteps(ctx context.Context, steps []sdk.Action, a sdk.
// Check if all newVariables are in currentJob.params
// variable can be add in w.currentJob.newVariables by worker command export
for _, newVariableFromHandler := range w.currentJob.newVariables {
if sdk.ParameterFind(w.currentJob.params, newVariableFromHandler.Name) == nil {
p := sdk.ParameterFind(w.currentJob.params, newVariableFromHandler.Name)
if p == nil {
w.currentJob.params = append(w.currentJob.params, newVariableFromHandler.ToParameter(""))
} else {
p.Value = newVariableFromHandler.Value
}
}

Expand Down

0 comments on commit 1bf3c5d

Please sign in to comment.