-
Notifications
You must be signed in to change notification settings - Fork 396
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 app spec validate-offline (Resolves #1449) #1450
Add app spec validate-offline (Resolves #1449) #1450
Conversation
…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
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this great contribution!
You provided a lot of great context in the issue. I also prefer your original design of the --schema-only
flag being used to determine if the token is needed or not. Reading over the problems you ran into, you are right that the --schema-only
flag is not available when command creation happens. But we can workaround this!
We can call initServices
directly if needed:
if err := c.initServices(c); err != nil {
return err
}
So rather than adding a new sub-command we can use the --schema-only
flag for this by:
- Creating the command with
cmdBuilderWithInit
like you did with thevalidate-offline
one. - Between the
if schemaOnly
block and thec.Apps().Propose
call, add the call toinitServices
This way, if the --schema-only
flag is passed, we exit before initializing the services. If not, we still initialize the services and check for the API token before making the API call.
…talocean#1449) Thanks to @andrewsomething for the suggestion! Reference: - digitalocean#1450 (review)
…talocean#1449) Thanks to @andrewsomething for the suggestion! Reference: - digitalocean#1450 (review)
…talocean#1449) (#1) Thanks to @andrewsomething for the suggestion! Reference: - digitalocean#1450 (review)
…talocean#1449) (#1) Thanks to @andrewsomething for the suggestion! Reference: - digitalocean#1450 (review)
a578ef5
to
8319fec
Compare
@andrewsomething: Thanks for that suggestion! I've refactored the code to use that method, and tested it against some proposed changes to This is ready for review again 😀 P.S.: 🙏 If someone could add the Hacktoberfest issue labels once this is accepted, that would be great! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM! Thanks again!
This PR implements a new sub-command, as described in #1449:
I followed a similar method to #225
When merged, this enables the following GitHub Actions feature to work:
Notes: My work on this PR was done as part of DigitalOcean + MLH's Hacktoberfest + Global Hack Week: Open Source