Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement templating within containerTemplate. #1006

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

EliZucker
Copy link
Member

@EliZucker EliZucker commented Jun 25, 2019

Changes

Taken from my commit message:

Before, ApplyReplacements() would apply templating replacements to the containers within spec.Steps, but never to the single container at spec.ContainerTemplate. Note that this didn't work earlier because containerTemplate is merged with the container specs after templating is applied.

Isolate the container-specific templating in applyContainerReplacements()
and apply that logic to the containerTemplate field.

This addresses #811.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide
for more details.

Release Notes

`containerTemplate` now supports variable interpolation

I modeled the note above from this similar PR for consistency.

Before, ApplyReplacements() would apply templating replacements to the containers within spec.Steps, but never to the single container at spec.ContainerTemplate. Note that this didn't work earlier because containerTemplate is merged with the container spec after templating is applied.

Isolate the container-specific templating in applyContainerReplacements()
and apply that logic to the containerTemplate field.

This addresses tektoncd#811.
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jun 25, 2019
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 25, 2019
@EliZucker
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, otherwise looking good ! 💃

@@ -17,6 +17,8 @@ limitations under the License.
package resources

import (
corev1 "k8s.io/api/core/v1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This import needs to be above 👼

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EliZucker, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2019
@ghost
Copy link

ghost commented Jun 25, 2019

/lgtm

@tekton-robot tekton-robot assigned ghost Jun 25, 2019
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2019
@tekton-robot tekton-robot merged commit 082825f into tektoncd:master Jun 25, 2019

// Apply variable expansion to containerTemplate fields.
if spec.ContainerTemplate != nil {
applyContainerReplacements(spec.ContainerTemplate, replacements)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized we need to do this for stepTemplate as well @EliZucker 😅

lemme know if you don't want to do it, I can open a bug also

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this PR!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa so fast! thanks @EliZucker :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants