circleci-cli
circleci-cli copied to clipboard
Add `list project environment variable` subcommand (one of commands to manage projects)
Checklist
=========
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have checked for similar issues and haven't found anything relevant.
- https://github.com/CircleCI-Public/circleci-cli/issues/652 is the issue that this PR is targeting
- [x] This is not a security issue (which should be reported here: https://circleci.com/security/)
- [x] I have read Contribution Guidelines.
Changes
=======
- Add a project command
- Add a subcommand to list project environment variables
-
circleci project secret list <vcs> <org> <project>
-
- Add a subcommand to list project environment variables
- Replace a request header
Accept-Type
withAccept
inapi/rest/client.go
Rationale
=========
This PR partially solves https://github.com/CircleCI-Public/circleci-cli/issues/652. Currently, CircleCI CLI does not have the ability to manage Projects. This change enables one of these abilities and makes it easier to write the rest subcommands.
Considerations
==============
- Replace a request header
Accept-Type
withAccept
inapi/rest/client.go
-
Accept
header, rather thanAccept-Type
, is generally used to controllcontent-type
response header - The API
projects/envvar
requiresAccept
header to return responses ofcontent-type:application/json
- If not the case, the response header is
content-type:text/plain
- This can't be accepted by the Client of
api/rest/client.go
- If not the case, the response header is
- With my checking, the
runner
API doesn't careAccept-Type
header- I checked that
runner resource-class
andrunner token
commands succeeded withoutAccept-Type
orAccept
- ref. https://github.com/CircleCI-Public/circleci-cli/pull/474 is the PR that the
Accept-Type
is added
- I checked that
-
I will add other subcommands to manage project environment variables like create
and delete
.
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.
Codecov Report
:exclamation: No coverage uploaded for pull request base (
main@c849191
). Click here to learn what that means. Patch has no changes to coverable lines.
:exclamation: Current head d9b35dd differs from pull request most recent head a3f7e7d. Consider uploading reports for the commit a3f7e7d to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #770 +/- ##
=======================================
Coverage ? 33.64%
=======================================
Files ? 49
Lines ? 5495
Branches ? 0
=======================================
Hits ? 1849
Misses ? 3390
Partials ? 256
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@CircleCI-Public/Extensibility Could you review this PR? As I am new to this project as a contributor, please let me know if there is anything I have to do for your review.
Hello @threepipes This PR is large, could it possibly be broken down into smaller PRs. ie: Accept-Type in one PR and project command in a separate one? Thank you
@corinnesollows Thank you for your comment and advice. Sure, I will make a PR for the Accept-Type header. I will let this PR be as of now because the Accept-Type change is required for the current implementation. So I hope you will check this one after checking the Accept-Type one.
The header changes are extracted: https://github.com/CircleCI-Public/circleci-cli/pull/784
@corinnesollows
Thank you for your approval of https://github.com/CircleCI-Public/circleci-cli/pull/784.
This PR no longer contains the Accept-Type
header changes.
If there are any more requirements, feel free to let me know.
It would be extremely tight if this could get some attention @CircleCI-Public/Extensibility @corinnesollows