Interface HookScript

All Superinterfaces:
MinimalHookScript

public interface HookScript extends MinimalHookScript
Describes a hook script.

A script represents some form of executable, such as a shell script or binary, which can be run in response to repository changes. Scripts are managed separately from the repositories where they're enabled to simplify the process of administering them. For example, if a given script is enabled in 2,000 different repositories, it can be updated in, or deleted from, all of them simultaneously with a single operation.

Since:
6.2
  • Method Details

    • getCreatedDate

      @Nonnull Date getCreatedDate()
      Returns:
      the date the script was created
    • getDescription

      @Nonnull Optional<String> getDescription()
      Retrieves the script's description. Descriptions are limited to 255 characters but are otherwise free-form.
      Returns:
      the script's description
    • getName

      @Nonnull String getName()
      Retrieves the script's name. Names are limited to 255 characters but are otherwise free-form.

      When a pre-style hook script rejects an update, the script's name is included in the veto added to the hook result. Like a filename, hook script names should be short, but descriptive. (However, unlike a filename, filesystem limitations do not apply to hook script names.)

      Returns:
      the script's name
    • getPluginKey

      @Nonnull String getPluginKey()
      Retrieves the plugin key for the app which created the script. Plugin keys are limited to 255 characters.

      When a script is created, the app which creates it must provide its plugin key. This allows scripts to be associated with the app that created them, for administrative purposes.

      Note: App developers are strongly discouraged from changing their plugin keys. While the key associated with a hook script can be updated later, this is only one of many references the overall system may have to an app's plugin key.

      Returns:
      the plugin key for the app which created the script
    • getSize

      int getSize()
      Returns:
      the size of the script's contents
    • getType

      @Nonnull HookScriptType getType()
      Retrieves the script's type.

      Hook scripts can be written to be invoked as PreRepositoryHooks or PostRepositoryHooks. The type must be specified when the script is created, and cannot be updated after.

      Returns:
      the script's type, indicating whether it will be invoked before or after changes are accepted
    • getUpdatedDate

      @Nonnull Date getUpdatedDate()
      Returns:
      the date the script was last updated