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

Add a subcommand to create a project environment variable #846

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

threepipes
Copy link
Contributor

@threepipes threepipes commented Feb 17, 2023

Checklist

=========

Internal Checklist

  • I am requesting a review from my own team as well as the owning team
  • I have a plan in place for the monitoring of the changes that I am making (this can include new monitors, logs to be aware of, etc...)

Changes

=======

  • Add one of the project subcommands
    • circleci project secret create <vcs> <org> <project> <env-name>

Rationale

=========

This PR partially solves #652.
And this PR is the subsequent change to #770.

Examples

============

$ go run main.go project secret create gh OrgName PrjName foo
Enter the environment variable value and press enter ●●●●●●●
Environment variable name=foo value=xxxxest already exists. Do you overwrite it? Yes
+----------------------+---------+
| ENVIRONMENT VARIABLE |  VALUE  |
+----------------------+---------+
| foo                  | xxxxenv |
+----------------------+---------+
$ go run main.go project secret create gh OrgName PrjName bar --env-value somevalue
+----------------------+----------+
| ENVIRONMENT VARIABLE |  VALUE   |
+----------------------+----------+
| bar                  | xxxxalue |
+----------------------+----------+
$ go run main.go project secret create gh OrgName PrjName bar --env-value somevalue
Environment variable name=bar value=xxxxalue already exists. Do you overwrite it? No
Canceled

Here are some helpful tips you can follow when submitting a pull request:

  1. Fork the repository and create your branch from main.
  2. Run make build in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (make test).
  5. The --debug flag is often helpful for debugging HTTP client requests and responses.
  6. Format your code with gofmt.
  7. Make sure your code lints (make lint). Note: This requires Docker to run inside a local job.

}

// ProjectOption configures a command created by NewProjectCommand
type ProjectOption interface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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


"github.com/CircleCI-Public/circleci-cli/settings"
"github.com/spf13/cobra"
)

// UserInputReader displays a message and reads a user input value
type UserInputReader interface {
Copy link
Contributor Author

@threepipes threepipes Feb 17, 2023

Choose a reason for hiding this comment

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

I added this interface for mock input on tests.

@threepipes threepipes changed the base branch from main to develop February 17, 2023 15:02
@threepipes threepipes marked this pull request as ready for review February 17, 2023 15:05
@threepipes threepipes requested a review from a team as a code owner February 17, 2023 15:05
@JulesFaucherre JulesFaucherre merged commit 7602c67 into CircleCI-Public:develop Mar 6, 2023
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