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

Fix issue where workspace volume variable and pod volume conf differ #3315

Merged
merged 1 commit into from Oct 2, 2020
Merged

Fix issue where workspace volume variable and pod volume conf differ #3315

merged 1 commit into from Oct 2, 2020

Conversation

ghost
Copy link

@ghost ghost commented Oct 1, 2020

Changes

Fixes #3312

Prior to this commit the volumes that were generated for workspace bindings did not have names that matched the values injected through workspaces.<name>.volume variables. This occurred because we called the GetVolumes workspace function twice during TaskRun Pod initialization and each execution generated different random names.

This commit updates the TaskRun reconciler to generate the random volume names only once and then pass those generated volumes to the two functions that need them. Additionally the function generating those volumes is renamed to make clear that volume creation is its purpose. A e2e test is added to ensure that the workspace volume and variable value matches.

Submitter Checklist

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

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

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.

Release Notes

Fixed a bug where a workspace's volume name did not match the value from workspace.<name>.volume variables.

Prior to this commit the volumes that were generated for workspace bindings
did not have names that matched the values injected through
workspaces.<name>.volume variables. This occurred because we called
the GetVolumes workspace function twice during TaskRun Pod initialization and
each execution generated different random names.

This commit updates the TaskRun reconciler to generate the random volume
names only once and then pass those generated volumes to the two functions
that need them. Additionally the function generating those volumes is renamed
to make clear that volume creation is its purpose. A e2e test is added to
ensure that the workspace volume and variable value matches.
@ghost ghost added the kind/bug Categorizes issue or PR as related to a bug. label Oct 1, 2020
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 1, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 94.7% 94.6% -0.1

@vdemeester vdemeester added this to the Pipelines v0.17 milestone Oct 2, 2020
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.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 2, 2020
volumeNames := []string{}
for _, volume := range p.Spec.Volumes {
if volume.Name == workspaceVariableValue {
return
Copy link
Member

Choose a reason for hiding this comment

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

the idea here is to declare a test success once volume name matches with the workspace from containers args list. Without such match, test would fail with error on 318, took a little bit of reading to understand 😜

Copy link
Member

@pritidesai pritidesai left a comment

Choose a reason for hiding this comment

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

thanks @sbwsg 👍

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai

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 Oct 2, 2020
@tekton-robot tekton-robot merged commit cfe2fe0 into tektoncd:master Oct 2, 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/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Volume name differs between $(workspaces.foo.volume) and actual Volume/VolumeMount config
3 participants