Skip to content

Commit

Permalink
fix: check for duplicates after applying the substitutions
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves committed Jan 25, 2025
1 parent 2670c66 commit 49625ec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/reconciler/taskrun/resources/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ func applyStepActionParameters(step *v1.Step, spec *v1.TaskSpec, tr *v1.TaskRun,
arrayReplacements[k] = v
}

// check if there are duplicate keys in the replacements
// if the same key is present in both stringReplacements and arrayReplacements, it means
// that the default value and the passed value have different types.
err := checkForDuplicateKeys(stringReplacements, arrayReplacements)
if err != nil {
return nil, err
}

// 4. set step result replacements last
stepResultReplacements, err := replacementsFromStepResults(step, stepParams, defaults)
if err != nil {
Expand All @@ -107,6 +99,14 @@ func applyStepActionParameters(step *v1.Step, spec *v1.TaskSpec, tr *v1.TaskRun,
stringReplacements[k] = v
}

// check if there are duplicate keys in the replacements
// if the same key is present in both stringReplacements and arrayReplacements, it means
// that the default value and the passed value have different types.
err = checkForDuplicateKeys(stringReplacements, arrayReplacements)
if err != nil {
return nil, err
}

container.ApplyStepReplacements(step, stringReplacements, arrayReplacements)
return step, nil
}
Expand Down

0 comments on commit 49625ec

Please sign in to comment.