massdriver-cloud / massdriver-cli

Deprecated. See https://github.com/massdriver-cloud/mass
https://massdriver.cloud
Apache License 2.0
3 stars 2 forks source link

wip: prompt for package configure #129

Closed jaketf closed 1 year ago

jaketf commented 1 year ago

This PR uses https://github.com/jackdelahunt/survey-json-schema to prompt the user to fill out all necessary package configuration in the CLI.

TODOs:

jaketf commented 1 year ago

ok current status on this is working through why graphQL library or API is choking when sending a valid params as a variable complaining about unknown keys. This will probably just take a bit more thrashing to get the client library to pass this along the way the API expects.

mass -v package configure jakegcp-gcpplay-o11y
DBG Configuring package packageName=jakegcp-gcpplay-o11y
DBG Getting package packageName=jakegcp-gcpplay-o11y
DBG Got package packageName=jakegcp-gcpplay-o11y
DBG Prompting for params
DBG Prompting for presets
? Choose a guided configuration for this package: Development
? Enter a value for enable_binary_authorization Yes
? Enter a value for cluster_ipv4_cidr_block /16
? Enter a value for master_ipv4_cidr_block 172.16.0.0/28
? Enter a value for services_ipv4_cidr_block /20
? Enter a value for enable_ingress No
? Enter a value for k8s_version 1.21
? Enter a value for destination disabled
DBG Params params="map[cluster_configuration:map[enable_binary_authorization:true] cluster_networking:map[cluster_ipv4_cidr_block:/16 master_ipv4_cidr_block:172.16.0.0/28 services_ipv4_cidr_block:/20] core_services:map[cloud_dns_managed_zones:[] enable_ingress:false] k8s_version:1.21 node_groups:[] observability:map[logging:map[destination:disabled]]]"
DBG Params Marshaled paramString="{\"cluster_configuration\":{\"enable_binary_authorization\":true},\"cluster_networking\":{\"cluster_ipv4_cidr_block\":\"/16\",\"master_ipv4_cidr_block\":\"172.16.0.0/28\",\"services_ipv4_cidr_block\":\"/20\"},\"core_services\":{\"cloud_dns_managed_zones\":[],\"enable_ingress\":false},\"k8s_version\":\"1.21\",\"node_groups\":[],\"observability\":{\"logging\":{\"destination\":\"disabled\"}}}"
Error: Message: Argument "params" has invalid value $params.
In field "cluster_configuration": Unknown field.
In field "cluster_networking": Unknown field.
In field "core_services": Unknown field.
In field "k8s_version": Unknown field.
In field "node_groups": Unknown field.
In field "observability": Unknown field., Locations: [{Line:1 Column:164}]
jaketf commented 1 year ago

Latest Status:

coryodaniel commented 1 year ago

Looks good re: config file.

What do you think about -c or -f for the config file?

I feel like those are the more canonical flags and if we want to support Yaml (which is what I’ll probably write mine in) we can easily check the file extension and load the correct parser without making people change the flags are passing