Skip to content

Conversation

@inteon
Copy link
Member

@inteon inteon commented Nov 20, 2024

Fixes bug introduced in #65.

Chown was using the tsDirName instead of the full path: https://github.com/cert-manager/csi-lib/compare/main...inteon:csi-lib:bugfix?expand=1#diff-ba1745ccd4960836e72c7cf9c559b61ecceab32eb78f3be37d56d8c777c1d141L269

This resulted in WriteFiles returning an error.

This caused the dependency upgrade PR for csi-driver to fail: cert-manager/csi-driver#322

I'll add more improvements and extra tests in a follow-up PR.

@cert-manager-prow cert-manager-prow bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 20, 2024
@cert-manager-prow cert-manager-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 20, 2024
@munnerz
Copy link
Member

munnerz commented Nov 20, 2024

I wonder what we can do to get signal that this broke csi-driver sooner? Perhaps we can add an optional test job that fetches the csi-driver and attempts to build it with the PRs version of the csi-lib imported/required? i.e. git clone csi-driver && go mod replace github.com/cert-manager/csi-lib github.com/cert-manager/csi-lib@v{PR} && make test or something?

@cert-manager-prow cert-manager-prow bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 20, 2024
@inteon
Copy link
Member Author

inteon commented Nov 20, 2024

I wonder what we can do to get signal that this broke csi-driver sooner? Perhaps we can add an optional test job that fetches the csi-driver and attempts to build it with the PRs version of the csi-lib imported/required? i.e. git clone csi-driver && go mod replace github.com/cert-manager/csi-lib github.com/cert-manager/csi-lib@v{PR} && make test or something?

There is a lot we can do to improve this repository, including making the existing tests more real-life (eg. using a real file system).

for filename := range files {
// Set the uid to -1 which means don't change ownership in Go.
if err := os.Chown(filepath.Join(tsDirName, filename), -1, int(*fsGroup)); err != nil {
if err := os.Chown(filepath.Join(f.dataPathForVolumeID(meta.VolumeID), tsDirName, filename), -1, int(*fsGroup)); err != nil {
Copy link
Member Author

@inteon inteon Nov 20, 2024

Choose a reason for hiding this comment

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

This is the minimal fix. This PR taught me about a lot about other possible improvements, they will be part of v0.9.0 instead.
This minimal fix matches what we were doing before: https://github.com/cert-manager/csi-lib/pull/65/files#diff-ba1745ccd4960836e72c7cf9c559b61ecceab32eb78f3be37d56d8c777c1d141L270

@SgtCoDFish
Copy link
Member

I'm happy to believe this is the minimal fix and it works, but it's not clear to me from this PR why this fix was required by updating the csi-driver deps. What actually changed to cause a break? Can we add that detail to this PR for future reference?

@inteon
Copy link
Member Author

inteon commented Nov 20, 2024

I'm happy to believe this is the minimal fix and it works, but it's not clear to me from this PR why this fix was required by updating the csi-driver deps. What actually changed to cause a break? Can we add that detail to this PR for future reference?

I added the missing link to #65, which is where the bug was introduced (+ see the code link in the description for the exact line).

@inteon inteon requested a review from SgtCoDFish November 20, 2024 21:25
Copy link
Member

@SgtCoDFish SgtCoDFish left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Thanks for confirming that it was upgrading csi-lib specifically which caused the issue! It seems to me this is worth merging as-is.

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SgtCoDFish

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

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2024
@cert-manager-prow cert-manager-prow bot merged commit 4e16ea6 into cert-manager:main Nov 21, 2024
3 checks passed
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. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants