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

Ability to validate App Spec Schema in Offline Mode #1449

Closed
trinitronx opened this issue Oct 22, 2023 · 0 comments
Closed

Ability to validate App Spec Schema in Offline Mode #1449

trinitronx opened this issue Oct 22, 2023 · 0 comments

Comments

@trinitronx
Copy link
Contributor

trinitronx commented Oct 22, 2023

What is the problem this feature would solve? Please describe.

This feature would solve the following problems & issues:

Describe the solution you'd like

Some way to validate a DigitalOcean App Spec in offline mode should be provided. A separate command (e.g. validate-offline) should be decoupled from the godo API client & auth initialization to support this use case.

Additional context

Currently, the doctl app spec validate command is tightly coupled to require godo init and doctl auth. The validateCommand is defined using CmdBuilder(), which calls cmdBuilderWithInit(..., true, options...) with initCmd set to true always (This is passed to NewCmdConfig() as the initGodo parameter which runs cmdConfig.initServices()).

As such, the --schema-only flag still requires doctl auth and a godo client is initialized. Unfortunately due to the way Cobra commands appear to be set up, the --schema-only flag is not available in the context where the command creation happens. Therefore, it seems that we must implement a new sub-command for this feature (e.g. doctl app spec validate-offline). The usage of cmdBuilderWithInit similar to this command PR seems to be the proper method to setup this new command.

trinitronx added a commit to trinitronx/doctl that referenced this issue Oct 22, 2023
…cean#1449)

Implement a new command to validate an app spec without requiring
auth & connection to the API. This is useful for validating app specs
in CI pipelines and untrusted environments.  As there is no currently
published [YAML schema][1] for use with [`redhat.vscode-yaml`][2], this
seems to be the best approach for now.

[1]: https://www.schemastore.org/json/
[2]: https://github.com/redhat-developer/yaml-language-server
trinitronx added a commit to LyraPhase/pre-commit-digitalocean that referenced this issue Oct 22, 2023
trinitronx added a commit to LyraPhase/pre-commit-digitalocean that referenced this issue Oct 22, 2023
trinitronx added a commit to trinitronx/doctl that referenced this issue Oct 23, 2023
trinitronx added a commit to trinitronx/doctl that referenced this issue Oct 23, 2023
trinitronx added a commit to trinitronx/doctl that referenced this issue Oct 23, 2023
trinitronx added a commit to trinitronx/doctl that referenced this issue Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant