nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.27k stars 132 forks source link

--json output doesn't work on vultr? #1459

Closed unusualevent closed 1 year ago

unusualevent commented 1 year ago

trying to get --json output to work for:

are global options something that like MacOS needs to be at the front of the command? or can they be at the end of the options?

unusualevent commented 1 year ago

that would be useful to script together:

old_image=$(ops image list --json --filter "somename" | jq 'sort to newest')
go build thing.go
ops image create imgname -t vultr
# get single ID instead of a table
image_tag=$(ops image list --json | jq 'sort to newest....')
# launch newer instances
for i in 1..5; do
ops instance create $image_tag -t vultr --label somelabel --domain $i.somedomain
done
sleep 10m # let the cluster heal
# kill the old instances
for instance in $(ops instance list --filter $old_image); do
ops instance delete $instance -t vultr
done
eyberg commented 1 year ago

since we have so many providers/targets we sometimes don't add functionality for everything at once - this should be relatively easy to do though; happy to accept any prs for it

unusualevent commented 1 year ago

how ugly can the PR be? I'm also after getting the labels / domain names / names built - are you expecting PRs to have no new dependencies or something?

eyberg commented 1 year ago

we are totally ok with prs that don't diverge much from existing behavior and add incremental benefits/features

I think we can merge things that are shorter/feature specific much faster than larger changes - if you have completely different requests I'd break those up into diff prs

as for including new deps - we'd like to avoid that as much as we can - there's already a lot of existing 3rd party software that's included - good chance you can find existing behavior elsewhere in the code that could be re-used

unusualevent commented 1 year ago

@eyberg looking through this trying to find an example of where I would need to extend the provider.

unusualevent commented 1 year ago

added to PR #1462

eyberg commented 1 year ago

thanks!

unusualevent commented 1 year ago

@eyberg note - I can't build this locally. You're on 1.19.5 and I was using go1.20.3 - so I guess it's gonna have to wait until a new release artifact is published.

eyberg commented 1 year ago

the version shouldn't matter; if you're running into a build issue that is a diff. problem (possibly protobufs?)

unusualevent commented 1 year ago

https://github.com/distribution/distribution/issues/3590 <- it's this. my checksum db doesn't match the one you checked into the repo, when I clean the cache and retry it.

eyberg commented 1 year ago

oh, you could nuke the gosum, bump go.mod deps and you'll prob be ok

unusualevent commented 1 year ago

nice, so this works vultr=$(ops instance list -t vultr --json | jq -r '.[] | select(.tag=="nanos")|.main_ip') - I just had to add the "nanos" tag to the instance after it was made.

Is there an existing convention/preference if I add hostnames/labels/tags to the vultr part of the cli? that would make filtering using JQ a little easier. Is the cli option supposed to be something like --label?

eyberg commented 1 year ago

yes - we add tags to a handful of providers today such as aws (https://github.com/nanovms/ops/blob/master/provider/aws/aws_image.go#L118) and gcp ( https://github.com/nanovms/ops/blob/master/provider/gcp/gcp_instance.go#L42 ) and filter everything based on that - we can/should do the same for vultr as it's very common to have a mix of nanos instances and non-nanos instances

eyberg commented 1 year ago

added tags for vultr instances here https://github.com/nanovms/ops/pull/1472 - i didn't see offhand a way to do this for snapshots