fix(emissary): strip trailing slash from artifact src before creating… #6696
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
At the moment when running workflows with Emissary executor and saving output artifacts, trailing and leading slashes in
srcPath
are not being taken into consideration before creating the destination file. When compressing a full directory,srcPath
could either be, for instance:/tmp
/tmp/
For now, paths are only being concatenated, leading in our second example to output paths looking like
/var/run/argo/outputs/artifacts//tmp/.tgz
. I believe this should probably bevar/run/argo/outputs/artifacts/tmp.tgz
My proposal consists of using :
filepath.Join
for concatenation, which would take care of potential specific characters (.
,..
and/
basically)strings.TrimSuffix
for getting rid of the trailing slashesI've also added a unit test case for validating the behaviour.
As it's my first time opening a pull request on Argo, I have no idea whether or not those changes might break any other parts of the codebase. Also please let me know if anything looks wrong regarding the implementation details.
As far as I know this PR does not address any open issues so please just let me know if this contribution does not make any sense to you folks.
Thanks in advance for taking the time to consider this change.
Signed-off-by: Elliot Maincourt [email protected]