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

Tagging vms for efficient multi-instance commands #121

Merged
merged 9 commits into from
Apr 17, 2023
Merged

Tagging vms for efficient multi-instance commands #121

merged 9 commits into from
Apr 17, 2023

Conversation

maxzinkus
Copy link
Collaborator

Tags will now be expanded for commands with multiple instance support:

  • cmd/delete.go
  • cmd/edit.go
  • cmd/publish.go
  • cmd/restart.go
  • cmd/start.go
  • cmd/stop.go

Format is: alpine start +tagname

For example:

$ alpine list
NAME       STATUS      SSH    PORTS     ARCH        PID   TAGS
mysql      Stopped     2022   3306      aarch64     -     daemon
foobar     Stopped     2023             aarch64     -     daemon,dev

$ alpine start +daemon
... starts mysql and foobar ...

$ alpine stop mysql +dev
... stops mysql and foobar ...

Tags will now be expanded for commands with multiple instance support:
* `cmd/delete.go`
* `cmd/edit.go`
* `cmd/publish.go`
* `cmd/restart.go`
* `cmd/start.go`
* `cmd/stop.go`

Format is: `alpine start +tagname`

For example:
```bash
$ alpine list
NAME       STATUS      SSH    PORTS     ARCH        PID   TAGS
mysql      Stopped     2022   3306      aarch64     -     daemon
foobar     Stopped     2023             aarch64     -     daemon,dev

$ alpine start +daemon
... starts mysql and foobar ...

$ alpine stop mysql +dev
... stops mysql and foobar ...
```
@maxzinkus maxzinkus requested a review from idroz April 16, 2023 02:35
@maxzinkus
Copy link
Collaborator Author

Hey @idroz! This one wraps up my work on tagging VMs and then using commands with +tagname which apply to each VM with that tag.

Requesting your review as there's a lot of code added, and probably some efficiency changes that could be made. If you have a chance, give it a quick test to make sure it works as you expect!

Closes #95

@maxzinkus maxzinkus self-assigned this Apr 16, 2023
@maxzinkus maxzinkus added the enhancement New feature or request label Apr 16, 2023
@maxzinkus maxzinkus linked an issue Apr 16, 2023 that may be closed by this pull request
@idroz
Copy link
Collaborator

idroz commented Apr 16, 2023

Awesome - thanks @maxzinkus . Just got back into work mode, so will review all the goodies.

@maxzinkus
Copy link
Collaborator Author

Awesome! Hope you had a good break. I went ahead and added alpine restart and alpine rename in the meanwhile :)

@maxzinkus maxzinkus added the awaiting review Blocking on input from a core maintainer label Apr 16, 2023
Tags will now be expanded for commands with multiple instance support:
* `cmd/delete.go`
* `cmd/edit.go`
* `cmd/publish.go`
* `cmd/restart.go`
* `cmd/start.go`
* `cmd/stop.go`

Format is: `alpine start +tagname`

For example:
```bash
$ alpine list
NAME       STATUS      SSH    PORTS     ARCH        PID   TAGS
mysql      Stopped     2022   3306      aarch64     -     daemon
foobar     Stopped     2023             aarch64     -     daemon,dev

$ alpine start +daemon
... starts mysql and foobar ...

$ alpine stop mysql +dev
... stops mysql and foobar ...
```
}

return flags
fmt.Println("launched: " + machineName)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cobra automatically adds completion for flags, as long as the user types the first - e.g. alpine launch -[tab]

@idroz
Copy link
Collaborator

idroz commented Apr 17, 2023

This looks awesome.

I've tested

  • cmd/delete.go
  • cmd/edit.go
  • cmd/publish.go
  • cmd/restart.go
  • cmd/start.go
  • cmd/stop.go

All work as expected. Code and doc changes look good. I think it's OK to be merged.

@maxzinkus maxzinkus merged commit b9a8433 into beringresearch:main Apr 17, 2023
@maxzinkus maxzinkus deleted the tagging-vms branch April 17, 2023 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review Blocking on input from a core maintainer enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tagging VMs
2 participants