-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
readOnly flag on workspace declarations #1760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM!
- Could you add a release notes to the PR description?
- How hard would it be to add an e2e test for this?
I added an example taskrun yaml to try and avoid writing a full e2e test. But I'm happy to write one too. Will pick this up tomorrow. |
script: cat $(workspaces.write-allowed.path)/foo | grep "hello" | ||
- name: write-disallowed | ||
image: ubuntu | ||
script: echo "goodbye" > $(workspaces.write-disallowed.path)/foo || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| touch write-failed.txt
then checking if the file exists would give you a stronger signal that the write operation failed, and didn't just succeed to write and then the contents were lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call.
Should have looked at the YAML test in more detail 😄 |
The following is the coverage report on pkg/.
|
I've added an e2e test that attempts to write to a readOnly workspace and then checks the log output to confirm that the attempted write causes an error. |
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
Introduce a readOnly flag to workspace declarations on tasks. This flag allows a task to declare whether it needs to write files to a workspace or simply read from it. Setting this flag to true will result in a volumeMount on the container with its readOnly flag also set to true.
The following is the coverage report on pkg/.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, 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 |
Part of #1438 |
Changes
Introduce a readOnly flag to workspace declarations on tasks. This flag allows a task to declare whether it needs to write files to a workspace or simply read from it.
Setting this flag to true will result in a volumeMount on the container with its readOnly flag also set to true.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Release Notes