circleci-cli
circleci-cli copied to clipboard
Fixes bash command error when DESTDIR is a non-path directory
- [x] I have read Contribution Guidelines.
- [x] I have checked for similar issues and haven't found anything relevant.
- [x] This is not a security issue (which should be reported here: https://circleci.com/security/)
Here are some helpful tips you can follow when submitting a pull request:
- Fork the repository and create your branch from
master
. - Run
make build
in the repository root. - If you've fixed a bug or added code that should be tested, add tests!
- Ensure the test suite passes (
make test
). - The
--debug
flag is often helpful for debugging HTTP client requests and responses. - Format your code with gofmt.
- Make sure your code lints (
make lint
). Note: This requires Docker to run inside a local job.
If you have any questions, feel free to ping us at @CircleCI-Public/x-team.
Problem
We found an issue with the install script on MacOS Catalina with bash 3.2 and Ubuntu 18 with bash 4.4, zsh 5.4.2.
When DESTDIR
is set to a directory that is not in PATH
, CircleCI CLI will successfully install but the script will error out on line 59.
Example output:
➜ DESTDIR=$(pwd)/clitemp ./install.sh
Starting installation.
Installing CircleCI CLI v0.1.7971
Installing to /home/ben/git/frshwtr/circleci-cli/clitemp
An error occured installing the tool.
The contents of the directory /tmp/tmp.HAAnGm47op have been left in place to help to debug the issue.
We suspect this is because command
is being executed with no directory context. Meaning any install to a non-path directory will fail, causing the install script to fail.
Testing
We have ran this locally on macOS Catalina with the following cases:
- setting
DESTDIR
and examining the exit code and status of the installed binary. - doing the same with the default (/usr/local/bin) set by the script.
All appears to work well in both cases.
Codecov Report
Merging #431 (4d8be28) into master (168582f) will decrease coverage by
1.91%
. The diff coverage isn/a
.
:exclamation: Current head 4d8be28 differs from pull request most recent head 330d65b. Consider uploading reports for the commit 330d65b to get more accurate results
@@ Coverage Diff @@
## master #431 +/- ##
==========================================
- Coverage 32.77% 30.86% -1.92%
==========================================
Files 46 26 -20
Lines 5415 3201 -2214
==========================================
- Hits 1775 988 -787
+ Misses 3387 2119 -1268
+ Partials 253 94 -159
Impacted Files | Coverage Δ | |
---|---|---|
filetree/filetree.go | 73.72% <0.00%> (-4.54%) |
:arrow_down: |
cmd/context.go | 25.14% <0.00%> (-3.05%) |
:arrow_down: |
references/references.go | 60.60% <0.00%> (-3.04%) |
:arrow_down: |
git/git.go | 81.25% <0.00%> (-2.36%) |
:arrow_down: |
cmd/update.go | 23.76% <0.00%> (-0.38%) |
:arrow_down: |
cmd/diagnostic.go | 17.30% <0.00%> (-0.20%) |
:arrow_down: |
main.go | 0.00% <0.00%> (ø) |
|
cmd/open.go | 50.00% <0.00%> (ø) |
|
cmd/check.go | 0.00% <0.00%> (ø) |
|
cmd/disabled.go | 0.00% <0.00%> (ø) |
|
... and 37 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.