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

Document all locations that variable substitution is available #2927

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

psschwei
Copy link
Contributor

@psschwei psschwei commented Jul 10, 2020

Changes

Fixes #2605 , adding a table to docs/variables.md with locations in our CRDs where variables will be successfully interpolated into.

Submitter Checklist

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

  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Jul 10, 2020
@psschwei psschwei marked this pull request as draft July 10, 2020 01:02
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 10, 2020
@psschwei
Copy link
Contributor Author

/kind documentation

@tekton-robot tekton-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Jul 10, 2020
@psschwei
Copy link
Contributor Author

/release-note-none

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 10, 2020
@pritidesai
Copy link
Member

@psschwei please squash three commits into one 🙏

| --- | ----- |
| `Task` | `credentials.path` |
| `Task` | `spec.steps[].name` |
| `Task` | `spec.steps[].image` |
Copy link
Member

Choose a reason for hiding this comment

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

this is great 👍

| `Task` | `spec.steps[].env.valuefrom.secretkeyref.name` |
| `Task` | `spec.steps[].env.valuefrom.secretkeyref.value` |
| `Task` | `spec.steps[].env.valuefrom.configmapkeyref.name` |
| `Task` | `spec.steps[].env.valuefrom.configmapkeyref.value` |
Copy link
Member

Choose a reason for hiding this comment

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

I think these five can be combined into one single spec.steps[].env, @sbwsg thoughts?

Copy link

Choose a reason for hiding this comment

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

My one concern is that we don't provide substitution for all fields under env - for example we don't substitute the .env.name field, nor any fields under .env.fieldRef or .env.resourceFieldRef.

My feeling is we should be more specific rather than less due to that. wdyt @pritidesai ?

@afrittoli afrittoli added kind/documentation Categorizes issue or PR as related to documentation. and removed kind/documentation Categorizes issue or PR as related to documentation. labels Jul 10, 2020
@afrittoli
Copy link
Member

/test pull-tekton-pipeline-unit-tests

@@ -113,3 +113,36 @@ variable via `resources.inputs.<resourceName>.<variableName>` or
| `name` | The name of the resource. |
| `type` | Type value of `"cloudEvent"`. |
| `target-uri` | The URI to hit with cloud event payloads. |

## Variables that can be substituted in a CRD
Copy link

Choose a reason for hiding this comment

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

Suggest "Task fields that accept variable substitutions" for the title here.

| `Task` | `spec.steps[].image` |
| `Task` | `spec.steps[].env.value` |
| `Task` | `spec.steps[].env.valuefrom.secretkeyref.name` |
| `Task` | `spec.steps[].env.valuefrom.secretkeyref.value` |
Copy link

Choose a reason for hiding this comment

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

| `Task` | `spec.steps[].env.valuefrom.secretkeyref.name` |
| `Task` | `spec.steps[].env.valuefrom.secretkeyref.value` |
| `Task` | `spec.steps[].env.valuefrom.configmapkeyref.name` |
| `Task` | `spec.steps[].env.valuefrom.configmapkeyref.value` |
Copy link

Choose a reason for hiding this comment

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

My one concern is that we don't provide substitution for all fields under env - for example we don't substitute the .env.name field, nor any fields under .env.fieldRef or .env.resourceFieldRef.

My feeling is we should be more specific rather than less due to that. wdyt @pritidesai ?

| `Task` | `spec.steps[].env.valuefrom.configmapkeyref.value` |
| `Task` | `spec.steps[].volumemounts.name` |
| `Task` | `spec.steps[].volumemounts.mountpath` |
| `Task` | `spec.steps[].volumemounts.submountpath` |
Copy link

Choose a reason for hiding this comment

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

| `Task` | `spec.volumes[].persistentvolumeclaim.claimname` |
| `Task` | `spec.volumes[].projected.sources.configmap.name` |
| `Task` | `spec.volumes[].projected.sources.secret.name` |
| `Task` | `spec.volumes[].projected.sources.serviceaccounttoken.audience` |
Copy link

Choose a reason for hiding this comment

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

These were also very recently added:

spec.volumes[].csi.nodepublishsecretref.name
spec.volumes[].csi.volumeattributes.*

That second one is a map of unspecified string keys so I'm not sure what the best way is to express it other than to use an *.

| `Task` | `spec.sidecars[].image` |
| `Task` | `spec.sidecars[].env.value` |
| `Task` | `spec.sidecars[].env.valuefrom.secretkeyref.name` |
| `Task` | `spec.sidecars[].env.valuefrom.secretkeyref.value` |
Copy link

Choose a reason for hiding this comment

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

same comment as above wrt .key vs .value for secrets and configmaps.

| `Task` | `spec.sidecars[].env.valuefrom.configmapkeyref.value` |
| `Task` | `spec.sidecars[].volumemounts.name` |
| `Task` | `spec.sidecars[].volumemounts.mountpath` |
| `Task` | `spec.sidecars[].volumemounts.submountpath` |
Copy link

Choose a reason for hiding this comment

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

and here submountpath -> subpath I think.

@psschwei psschwei force-pushed the docs-variable-substitution branch from 0a1af4d to 8d26e01 Compare July 14, 2020 16:51

| CRD | Field |
| --- | ----- |
| `Task` | `credentials.path` |
Copy link

Choose a reason for hiding this comment

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

This one is in error I think. It isn't a field that can receive variables.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

This is a very useful improvement, thank you! I think this just needs to have commits squashed into 1 and then I'll approve.

@ghost
Copy link

ghost commented Jul 14, 2020

Oh, also, do you plan to include Pipeline locations in this PR as well? Or prefer to merge as-is and tackle Pipeline locations separately?

@psschwei
Copy link
Contributor Author

This is a very useful improvement, thank you! I think this just needs to have commits squashed into 1 and then I'll approve.

Thanks for the great review! Made it really easy for me. :)

Oh, also, do you plan to include Pipeline locations in this PR as well? Or prefer to merge as-is and tackle Pipeline locations separately?

I was planning to do them both in the same PR, but I can split them up if that's easier. Let me know which you'd prefer.

@ghost
Copy link

ghost commented Jul 14, 2020

I was planning to do them both in the same PR, but I can split them up if that's easier. Let me know which you'd prefer.

Together in the same PR would be great.

@psschwei psschwei force-pushed the docs-variable-substitution branch from 08fde5c to c441126 Compare July 14, 2020 18:25
@psschwei
Copy link
Contributor Author

Together in the same PR would be great.

Will get the pipeline subs in later this week. Sorry for the delay in completing this!

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2020
@psschwei psschwei force-pushed the docs-variable-substitution branch from a76cd16 to e4a9cbf Compare July 21, 2020 01:55
@psschwei psschwei marked this pull request as ready for review July 21, 2020 01:56
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2020
@psschwei
Copy link
Contributor Author

/assign @pritidesai

@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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 21, 2020
| `Task` | `spec.sidecars[].volumemounts.mountpath` |
| `Task` | `spec.sidecars[].volumemounts.subpath` |
| `Pipeline` | `spec.tasks[].params[].value` |
| `Pipeline` | `spec.tasks[].conditions[].params[].value` |
Copy link

Choose a reason for hiding this comment

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

One more to add here: Pipeline | spec.results[].value

adding variable substitutions for pipelines
@psschwei psschwei force-pushed the docs-variable-substitution branch from 2c6cc01 to 4b63f1d Compare July 21, 2020 15:06
@ghost
Copy link

ghost commented Jul 21, 2020

/lgtm

Fantastic, thanks for taking this on.

@tekton-robot tekton-robot assigned ghost Jul 21, 2020
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2020
@tekton-robot tekton-robot merged commit 560dea2 into tektoncd:master Jul 21, 2020
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. kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document all locations that variable substitution is available
5 participants