bitops icon indicating copy to clipboard operation
bitops copied to clipboard

Dynamically install plugin version on runtime (deploy)

Open arm4b opened this issue 3 years ago • 4 comments

Requires (depends on) Set the plugin version on custom image build #315 for version in the plugin install.sh implementation first.

Provide users a way to install the needed plugin version on runtime(deploy) directly from the Omnibus image. In the ops repo's bitops.config.yaml for a given tool, support the ${tool}.options.version flag). That way, if users want to specify a version of a tool, it'll work (though it'll take longer). Then, when they are comfortable with things, they can create their own bitops image with pinned versions (which is more involved #315).

Example bitops.config.yaml for installing terraform version on runtime:

terraform:
    cli:
        var-file: my-vars.tfvars
        target: terraform.module.resource
    options:
        version: 1.2.3 # <--- new setting
        stack-action: "plan"
        workspace: test

and so 1.2.3 will be passed to the plugin install.sh to install the needed tool version: https://github.com/bitops-plugins/terraform/blob/b189c2dd7cb38e7e883837f0f3204e5b7e8a6e6b/install.sh#L13-L14 This was originally suggested here (for the TF plugin): https://github.com/bitovi/bitops/issues/307#issuecomment-1261306156.

When installing the tool on runtime, explicitly warn users about risks of using it:

WARNING: You've set the custom Terraform version 1.2.3 in the bitops.config.yaml. This will download and install the tool before every deploy, which is not recommended for production. Try it at your own risk! We encourage you to pre-package your own BitOps image instead. See how to do that: https://bitovi.github.io/bitops/plugins/#creating-your-own-bitops-image

See more details in the discussions below.

Previous Discussions

  • #307
  • https://github.com/bitovi/bitops/discussions/206

arm4b avatar Oct 10 '22 13:10 arm4b

I think this one should be "blocked" by https://github.com/bitovi/bitops/issues/315

mickmcgrath13 avatar Oct 10 '22 13:10 mickmcgrath13

It might also be good to set it behind a flag with a BIG warning to the effect of:

Setting this flag and specifying a tool version that is not pre-installed will cause BitOps to download the tool's version at deploy time. This setting is meant for development only, and you should pre-build your BitOps image (docs link) prior to any production implementation.

mickmcgrath13 avatar Oct 10 '22 13:10 mickmcgrath13

lol, sorry, didn't read the full description before commenting 🤦 I agree with the warning, and I do think we should set it behind a flag so users need to "opt in". The flag should be documented with a similar warning message.

mickmcgrath13 avatar Oct 10 '22 13:10 mickmcgrath13

Nice to have. Moderate effort. Lower priority.

arm4b avatar Oct 12 '22 16:10 arm4b