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: rework setupShellCommand #930

Merged
merged 2 commits into from
Dec 22, 2021
Merged

Conversation

catthehacker
Copy link
Member

@catthehacker catthehacker commented Dec 16, 2021

  • move all logic to separate function so we can test that later
  • split step.Shell and step.WorkingDirectory setup into own funcs
  • general cleanup of function
  • use ActPath to not collide with checked out repository (also avoids issues if path contains spaces)
  • use shellquote.Split() instead of strings.Fields() for better command split
  • replace single string concat with fmt

Fixes #884
Fixes #865

Signed-off-by: hackercat me@hackerc.at

@catthehacker catthehacker force-pushed the cat/fix/run-step branch 3 times, most recently from 7a49419 to b0766d6 Compare December 16, 2021 12:57
@codecov
Copy link

codecov bot commented Dec 16, 2021

Codecov Report

Merging #930 (18c648a) into master (0f04942) will increase coverage by 7.54%.
The diff coverage is 63.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #930      +/-   ##
==========================================
+ Coverage   49.27%   56.81%   +7.54%     
==========================================
  Files          23       28       +5     
  Lines        2401     4161    +1760     
==========================================
+ Hits         1183     2364    +1181     
- Misses       1090     1590     +500     
- Partials      128      207      +79     
Impacted Files Coverage Δ
pkg/common/executor.go 46.90% <0.00%> (+2.03%) ⬆️
pkg/common/job_error.go 0.00% <0.00%> (ø)
pkg/common/outbound_ip.go 0.00% <0.00%> (ø)
pkg/common/testflag.go 0.00% <0.00%> (ø)
pkg/container/docker_volume.go 0.00% <0.00%> (ø)
pkg/model/action.go 0.00% <ø> (ø)
pkg/container/docker_run.go 5.53% <14.54%> (+3.60%) ⬆️
pkg/common/git.go 49.82% <31.81%> (-9.97%) ⬇️
pkg/runner/logger.go 65.43% <37.50%> (+1.28%) ⬆️
pkg/container/docker_auth.go 45.00% <45.00%> (ø)
... and 35 more

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 4e0ba61...18c648a. Read the comment docs.

* move all logic to separate function so we can test that later
* split `step.Shell` and `step.WorkingDirectory` setup into own funcs
* general cleanup of function
* use `ActPath` to not collide with checked out repository
* use `shellquote.Split()` instead of `strings.Fields()` for better command split
* replace single string concat with `fmt`

Signed-off-by: hackercat <me@hackerc.at>
Signed-off-by: hackercat <me@hackerc.at>
@catthehacker catthehacker marked this pull request as ready for review December 16, 2021 13:17
@catthehacker catthehacker requested a review from a team as a code owner December 16, 2021 13:17
@catthehacker catthehacker requested a review from a team December 16, 2021 13:17
Copy link
Member

@KnisterPeter KnisterPeter left a comment

Choose a reason for hiding this comment

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

Looks fine with just a question from my side

pkg/runner/step_context.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue: Unable to run pwsh steps Issue: Unable to parse file paths that include spaces
4 participants