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

feat: add promotion step to remove a file/directory #3086

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nitishfy
Copy link
Member

@nitishfy nitishfy commented Dec 7, 2024

Fixes #2860

@nitishfy nitishfy requested a review from a team as a code owner December 7, 2024 12:36
Copy link

netlify bot commented Dec 7, 2024

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit c013076
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-io/deploys/6760397521ab9c0008291a8a
😎 Deploy Preview https://deploy-preview-3086.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Dec 7, 2024

Codecov Report

Attention: Patch coverage is 61.53846% with 15 lines in your changes missing coverage. Please review.

Project coverage is 51.22%. Comparing base (404422a) to head (9866605).

Files with missing lines Patch % Lines
internal/directives/file_deleter.go 61.53% 14 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3086      +/-   ##
==========================================
+ Coverage   51.20%   51.22%   +0.01%     
==========================================
  Files         283      284       +1     
  Lines       25466    25505      +39     
==========================================
+ Hits        13041    13065      +24     
- Misses      11729    11743      +14     
- Partials      696      697       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

},
},
{
name: "fails for non-existent path",
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to these tests, can you add:

  • One which removes a symlink (should remove the literal symlink, and not the file).
  • One which removes a file or directory within a symlink (should traverse into the symlink and remove it).

@krancour
Copy link
Member

krancour commented Dec 7, 2024

This needs docs.

@krancour
Copy link
Member

@nitishfy we're looking to have 1.2 work done by 12/20 with plans to release after the winter break. Are you able to implement feedback before then?

Signed-off-by: nitishfy <[email protected]>
},
},
{
name: "removes symlink only",
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
name: "removes symlink only",
name: "removes symlink only",

@hiddeco I tried debugging to understand why is this test case failing even though the path specified is correct. After debugging i found that, SecureJoin() is actually joining the file input/input.txt that is linked by the symlink.txt instead of joining the file symlink.txt, Following is the error message

=== RUN   Test_fileDeleter_runPromotionStep
--- FAIL: Test_fileDeleter_runPromotionStep (120.72s)
=== RUN   Test_fileDeleter_runPromotionStep/removes_symlink_only
path to delete: /tmp/Test_fileDeleter_runPromotionStepremoves_symlink_only1504252788/001/input/input.txt
    file_deleter_test.go:100: 
        	Error Trace:	/home/nitish/Documents/Work/Open-Source/kargo/internal/directives/file_deleter_test.go:100
        	            				/home/nitish/Documents/Work/Open-Source/kargo/internal/directives/file_deleter_test.go:115
        	Error:      	Received unexpected error:
        	            	stat /tmp/Test_fileDeleter_runPromotionStepremoves_symlink_only1504252788/001/input.txt: no such file or directory
        	Test:       	Test_fileDeleter_runPromotionStep/removes_symlink_only
    --- FAIL: Test_fileDeleter_runPromotionStep/removes_symlink_only (120.72s)

Copy link
Member Author

@nitishfy nitishfy left a comment

Choose a reason for hiding this comment

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

cc @hiddeco PTAL

@nitishfy
Copy link
Member Author

@nitishfy we're looking to have 1.2 work done by 12/20 with plans to release after the winter break. Are you able to implement feedback before then?

Yes. The failing test case is the only blockage so far, once the CI checks are running I'll add the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Kargo Promotion Step to Remove File and/or Directory
3 participants