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(emissary): strip trailing slash from artifact src before creating… #6696

Conversation

emaincourt
Copy link
Contributor

@emaincourt emaincourt commented Sep 9, 2021

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 be var/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 slashes

I'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]

@emaincourt emaincourt force-pushed the fix/emissary-remove-trailing-slash-from-src-path branch from 98de97e to cbfe167 Compare September 9, 2021 19:09
@alexec alexec enabled auto-merge (squash) September 9, 2021 19:29
@alexec
Copy link
Contributor

alexec commented Sep 9, 2021

@sarabala1979 can we add to v3.1.10?

@codecov
Copy link

codecov bot commented Sep 9, 2021

Codecov Report

Merging #6696 (1e9e8f0) into master (829cf13) will increase coverage by 0.02%.
The diff coverage is 50.00%.

❗ Current head 1e9e8f0 differs from pull request most recent head cbfe167. Consider uploading reports for the commit cbfe167 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6696      +/-   ##
==========================================
+ Coverage   48.63%   48.66%   +0.02%     
==========================================
  Files         262      262              
  Lines       18983    18983              
==========================================
+ Hits         9233     9238       +5     
+ Misses       8717     8708       -9     
- Partials     1033     1037       +4     
Impacted Files Coverage Δ
workflow/executor/emissary/emissary.go 0.00% <0.00%> (ø)
cmd/argoexec/commands/emissary.go 50.35% <100.00%> (-1.44%) ⬇️
workflow/controller/operator.go 71.28% <0.00%> (-0.10%) ⬇️
server/workflow/workflow_server.go 46.80% <0.00%> (+2.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 829cf13...cbfe167. Read the comment docs.

@alexec alexec merged commit 4b5d7ec into argoproj:master Sep 9, 2021
@sarabala1979 sarabala1979 mentioned this pull request Sep 13, 2021
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants