-
Notifications
You must be signed in to change notification settings - Fork 63
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
draft info
command proposal
#157
Comments
It would be good to add version to the supportedLanguages part.
|
How are we storing the mapping of language, version, and Dockerfile to use today? Can we expose that mapping instead of maintaining that logic separately in this command? |
Most of this information is stored in the templates, which are embedded in the binary. Dependent tools could reference those directories from the source instead, but then those tools would be dependent on the paths within the draft source code instead of an exposed command. This could open up a scenario where we refactor the code and suddenly break dependent tools without failing any checks or breaking changes to the binary tool. Having the command solidifies a contract for where we can always expect that information to be retrieved, and removing the command or changing its format would require reviewing a breaking change, while refactoring a template folder would not. If we want to expose that mapping logic, we could define a mapping file in the source code and do our best to protect it from changes. For dependencies that use draft as a go module we could export a package, but for dependencies like the vscode extension that wrap the binary they would have to just pull a file straight from the draft repo source code whereas currently it only uses the built draft binary. |
Can this command generate the mapping based on the template file/folder structure in the binary? I'm trying to minimize the potential drift that could happen when adding new templates/add-ons. I also want it to be easier for contributors to add templates without having to worry about updating the info command constantly. If we want to maintain the contract so that changes are breaking, perhaps a tool that runs as part of the pull request flow can build the contract? |
I think I didn't clarify this in the original proposal enough, but the Is the drift that you are referring to between the "info" command vs the actual templates? If so, the output of the command will be a generated by reading the templates, so it will keep itself in sync. |
That sounds great. Thumbs up 👍 |
Approved! |
💡 ⛩️ Thank you so much for the ping and adding me to this. Here is my 20 cents worth of thoughts/idea share from what I can get from this write-up. To understand better about the purpose, motivation and usage: (here is my thinking and sharing it if you find it useful). What is the target
|
@Tatsinnit thank you for your feedback and ideas!
The use case for this command is retrieving supported values for the draft config parameters in a machine readable format such as json.
this proposal is exclusively for the binary-wrapping consumer usage pattern, in which the draft binary is executed in a controlled environment and knowing valid values prior to executing a run can be used to elevate these options to the binary-wrapping context in a consistent way
i completely agree with these suggestions for improving the draft documentation, but they are outside the scope of this PR since this only aims to add a specific new command
this is a viable alternative approach, and is similar to what @sabbour was proposing higher up, but we decided against it since it would only work for templates that are provided with draft. Since one of the major ways that draft is extensible is through custom templates, adding a command allows us to create a process that generates the machine readable info for a binary-wrapping consumption pattern in a template-agnostic way. Thanks again for bringing these points up! They really helped clarify what the objective of the feature is, and I hope I addressed them all 😄 |
Is your feature request related to a problem? Please describe.
Draft's current capabilities are designed to be easy to wrap, and should be implementable by other services easily.
In order to make supported language and field discovery easier, I proposed adding a
draft info
command that prints supported deployment types, languages, and other important configuration information in a parsing-friendly format such as yaml or json.Mention what platform you want to support the new feature
The base draft cli tool should implement this feature to allow easy discovery of the available values for dependent services.
For a first milestone, I suggest a default output of
json
for thedraft info
command, that prints the following properties:supportedLanguages
andsupportedDeploymentTypes
each as an array of strings.Future milestones could include:
draft info -o yaml
Describe the solution you'd like
The
draft info
command should return a standardized output similar to the following:Describe alternatives you've considered
One alternative route is to publish a file that includes this information the draft repo, so that it can be referenced by other projects, potentially bundling an additional file with each release that details the available commands.
This alternative approach would incur more file-management, and break the single-binary goal of the current cli tool.
Additional context
To further the goal of making draft an extensible, opinionated tool with baked-in best practices, it must be not only extensible, but discoverable. Adding an
info
command is a step towards making draft even easier to rely on from an external service.The text was updated successfully, but these errors were encountered: