hashicorp / packer-plugin-sdk

Packer Plugin SDK enables building Packer plugins (builders, provisioners, or post-processors) to manage any service providers or custom in-house solutions
Mozilla Public License 2.0
34 stars 48 forks source link

Packer Plugin SDK for Subcommand #179

Open gintering1000 opened 1 year ago

gintering1000 commented 1 year ago

Please search the existing issues for relevant feature requests, and use the reaction feature (https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to add upvotes to pre-existing requests.

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

I am docker user. docker can manage image by tar file. Docker can manage image by tar 'file' for local file operator ( Command-based centralized management of images related to operating systems )

# Save Image to File
docker image save [disk_file.tar] [loaded_dockerimage]

# Load from File
docker image load [disk_file.tar]

# Upload to Official/Selfhost Registry
docker push [loaded_dockerimage]

# Download to Official/Selfhost Registry
docker pull [dockerimagename from dockerhub]

Packer can't manage ISOfile by command

# Save Image to File : This is What I want to make
packer push packer.box

# Load from File : This is What I want to make
packer image load [disk_file.iso]

# Upload to Official/Selfhost Registry : Maybe HCL PackerHub
packer push [packer.box]

# Download to Official/Selfhost Registry : Maybe HCL PackerHub
packer pull [packer.box]

image

this is difference between Docker and Packer So I'd like to make ISO manager by packer command Even I can use Other tool, but Packer is only provisioning tool for ISOFile And I Hope packer be All-in-One Tool.

Use Case(s)

subcommand Is main program feature so.. if you make some feature for plugin developer, they can control subsubcommand

your team can make new SDK for this. ( and packer command team also have to make new subcommand for this. for example : packer plugincli )

# packer plugin [SubCLI] [Option]
packer plugincli isomanager -save Centos.iso
packer plugincli isomanager -load Centos.iso
packer plugincli isomanager -info Centos-Stream8
packer plugincli isomanager -list Windows

Any relevant use-cases that you see.

Potential configuration

import (
  "github.com/hashicorp/packer-plugin-sdk/plugin"
)

// this part
type ExampleCLI struct{}

type ExampleBuilder struct{}
type FooPostProcessor struct{}
type BarProvisioner struct{}

func main() {
    pps := plugin.NewSet()

    // this part
    pps.RegisterCLI("isomanager", new(ExampleCLI))

    pps.RegisterBuilder("example", new(ExampleBuilder))
    pps.RegisterBuilder(plugin.DEFAULT_NAME, new(AnotherBuilder))
    pps.RegisterPostProcessor("foo", new(FooPostProcessor))
    pps.RegisterProvisioner("bar", new(BarProvisioner))
    err := pps.Run()
    if err != nil {
        fmt.Fprintln(os.Stderr, err.Error())
        os.Exit(1)
    }
}

Potential References