Skip to content

Commit

Permalink
pkg/apis: unexport ApplyContainerReplacements
Browse files Browse the repository at this point in the history
It is only used internally. This also removes the
`container_replacements_test.go` as the code is/should already be
covered by `sidecar_replacements_test.go` and
`step_replacements_test.go`.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Dec 2, 2020
1 parent 4e75034 commit a42e5ab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 152 deletions.
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/container_replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
corev1 "k8s.io/api/core/v1"
)

func ApplyContainerReplacements(step *corev1.Container, stringReplacements map[string]string, arrayReplacements map[string][]string) {
// applyContainerReplacements applies variable interpolation on a Container (subset of a Step).
func applyContainerReplacements(step *corev1.Container, stringReplacements map[string]string, arrayReplacements map[string][]string) {
step.Name = substitution.ApplyReplacements(step.Name, stringReplacements)
step.Image = substitution.ApplyReplacements(step.Image, stringReplacements)
step.ImagePullPolicy = corev1.PullPolicy(substitution.ApplyReplacements(string(step.ImagePullPolicy), stringReplacements))
Expand Down
149 changes: 0 additions & 149 deletions pkg/apis/pipeline/v1beta1/container_replacements_test.go

This file was deleted.

3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/sidecar_replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import (
"github.com/tektoncd/pipeline/pkg/substitution"
)

// ApplySidecarReplacements applies variable interpolation on a Sidecar.
func ApplySidecarReplacements(sidecar *Sidecar, stringReplacements map[string]string, arrayReplacements map[string][]string) {
sidecar.Script = substitution.ApplyReplacements(sidecar.Script, stringReplacements)
ApplyContainerReplacements(&sidecar.Container, stringReplacements, arrayReplacements)
applyContainerReplacements(&sidecar.Container, stringReplacements, arrayReplacements)
}
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/step_replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import (
"github.com/tektoncd/pipeline/pkg/substitution"
)

// ApplyStepReplacements applies variable interpolation on a Step.
func ApplyStepReplacements(step *Step, stringReplacements map[string]string, arrayReplacements map[string][]string) {
step.Script = substitution.ApplyReplacements(step.Script, stringReplacements)
ApplyContainerReplacements(&step.Container, stringReplacements, arrayReplacements)
applyContainerReplacements(&step.Container, stringReplacements, arrayReplacements)
}

0 comments on commit a42e5ab

Please sign in to comment.