Adding node-extensions support in CLI #147
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The aim of this PR is to add support for
node-extension
related operations to CLI.node-extensions
is being added, with two new commandsnode-extensions init
- used to initnode_extensions
section oftenderly.yaml
file, similar to how actions are being initializednode-extensions deploy
- used to deploy either a specific extension, or all extensions intenderly.yaml
filenode-extensions init
commandThis commands helps users initialize extensions in the
tenderly.yaml
file.It accepts the following arguments:
name
- used to specify extension namedescription
- used to specify extension descriptionmethodName
- used to specify extension method nameThe command checks whether the provided
methodName
is valid, and then prompts the user to select one action from a list of those eligible for extensions (presented in the following format:account/project:action
).The list will contain only actions that are not already used by other extensions in
tenderly.yaml
file.If there are no actions, eligible for extensions, found in
tenderly.yaml
, the command will return an error.If there are eligible actions in
tenderly.yaml
, but all already used for other extensions intenderly.yaml
, the command will return an error.Once the user has picked an action, the command will check whether the chosen extension method name is already taken by another extension in the same
account/project
and, if so, return an error.Otherwise, the command will add the extension to the
tenderly.yaml
.node-extensions deploy
commandThis command deploys extensions specified in
tenderly.yaml
file.It accepts the following arguments:
account
- used to specify which account the extension is defined for intenderly.yaml
project
- used to specify which project the extension is defined for intenderly.yaml
extensionName
- used to specify which extension in the providedaccount/project
should be deployedIf no arguments are provided, the command will attempt to deploy all extensions defined in
tenderly.yaml
. In case any of those extension deployments fail, it will print out the failure reasons and continue with deployment.The deployment of an extension has two steps. In case there are multiple extensions being deployed, these same steps are repeated for each extension being deployed.
1. Validation
This step performs the following checks:
account/project
account/project
If any of these checks fail, the deployment of the extension won't go through. Results of all four checks are aggregated and presented to the user in an error message.
2. Deployment
This step deploys the extension to the backend.
It executes only if the Validation step succeeds.