Skip to content

feat(plugins): Add plugin support

Oscar Tovar requested to merge otovar/add-gitlab-plugins into main

Description

Plugins allow users to extend the capabilities of the CLI. To build one, the plugin must adhere to the following:

  1. The plugin must start with the app prefix and separated by a dash. For example:

    $ glab-echo
  2. The plugin executable must be locatd somewhere along your $PATH.

  3. The plugin must respond with a JSON object that includes the version and description when it's invoked with the --metadata flag. For example:

    $ glab-echo --metadata
    {"version": "v1.0.0", "description": "Short description"}
  4. The plugin must be enabled manually before it's run. This is a security measure to ensure that only vetted plugins are run. To enable the plugin, run glab plugin enable [plugin]. For example, to enable the echo plugin (backed by glab-echo), you'd run:

    $ glab plugin enable echo

    When a plugin is enabled, a checksum of the executable is saved. If the executable is modified, the plugin will fail to run, and log a message asking the user to re-enable the plugin. Ideally this means vetting the executable once more re-enablement.

Related Issues

Resolves #1053

How has this been tested?

TODO

Screenshots (if appropriate):

TODO

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Oscar Tovar

Merge request reports