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

Add support for secret and configMap valueFrom and envFrom fields in … #982

Merged
merged 1 commit into from
Jun 14, 2019

Conversation

vdemeester
Copy link
Member

Changes

…templating

Currently, we support template on the environment variables key, but
not if the environment variable comes from a ConfigMap or a
Secret.

The following won't work.

    env:
    - name: GOPATH
      value: /workspace
    - name: GITHUB_TOKEN
      valueFrom:
        secretKeyRef:
          name: ${inputs.params.github-token-secret}
          key: bot-token

This fixes that and add support for using variable interpolation on
valueFrom.secretKeyRef and valueFrom.configMapKeyRef.

This also adds variable interpolation on envFrom.

This would fix this 👼

/cc @bobcatfish

Signed-off-by: Vincent Demeester [email protected]

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

`env.$var.valueFrom` and `envFrom` now supports variable interpolation

@tekton-robot tekton-robot requested a review from bobcatfish June 13, 2019 16:04
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jun 13, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 13, 2019
Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

imo in the long run we should support templating in all container spec fields in both steps and the container template (#811 (comment)) but I don't mind making an incremental step toward that :)

could you also add to https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#templating that these values can be templated? 😇

other than that lgtm :D

…templating

Currently, we support template on the environment variables key, *but*
not if the environment variable comes from a `ConfigMap` or a
`Secret`.

The following won't work.

```
    env:
    - name: GOPATH
      value: /workspace
    - name: GITHUB_TOKEN
      valueFrom:
        secretKeyRef:
          name: ${inputs.params.github-token-secret}
          key: bot-token
```

This fixes that and add support for using variable interpolation on
`valueFrom.secretKeyRef` and `valueFrom.configMapKeyRef`.

This also adds variable interpolation on `envFrom`.

Signed-off-by: Vincent Demeester <[email protected]>
@vdemeester vdemeester force-pushed the moar-step-templating branch from faf8de2 to 6a4ff33 Compare June 14, 2019 08:43
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 14, 2019
@zouyee
Copy link
Contributor

zouyee commented Jun 14, 2019

SGTM

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

/lgtm
/meow space

secretKeyRef:
name: ${inputs.params.github-token-secret}
key: bot-token
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

🎉

@tekton-robot
Copy link
Collaborator

@bobcatfish: cat image

In response to this:

/lgtm
/meow space

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 14, 2019
@bobcatfish
Copy link
Collaborator

helm_task_test.go:98: Waiting for service to get external IP
helm_task_test.go:118: Polling service with external IP
helm_task_test.go:130: Error from pinging service IP 34.66.81.109 : timed out waiting for the condition

hm, that's new!

@bobcatfish
Copy link
Collaborator

/test pull-tekton-pipeline-integration-tests

@tekton-robot tekton-robot merged commit f4b73c8 into tektoncd:master Jun 14, 2019
@vdemeester vdemeester deleted the moar-step-templating branch June 14, 2019 20:29
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