pf4jStage Plugin Deployment Example

Add, configure, deploy, and troubleshoot the RandomWait Stage plugin.

Overview

Note: Spinnaker 1.20.6 and 1.21+ support plugins with both server and frontend components. Spinnaker 1.19.x does not support frontend plugins due to a bug in Deck.

In this guide, you deploy the pf4jStagePlugin plugin from the spinnaker-plugin-examples repository.

By implementing Orca’s SimpleStage PF4J extension point, the pf4jStagePlugin creates a custom pipeline stage that waits a random number of seconds before signaling success. This plugin consists of a random-wait-orca Kotlin server component and a random-wait-deck React UI component that uses the rollup.js plugin library.

Requirements

This guide was tested with the following software versions:

  • Spinnaker 1.20.6 and 1.21+
  • Halyard 1.36
  • pf4jStagePlugin 1.1.14

Add the plugin repository

  1. hal plugins repository add examplePluginsRepo \
  2. --url=https://raw.githubusercontent.com/spinnaker-plugin-examples/examplePluginRepository/master/plugins.json

This adds the following YAML to your Halconfig:

  1. spinnaker:
  2. extensibility:
  3. plugins: {}
  4. repositories:
  5. examplePluginsRepo:
  6. id: examplePluginsRepo
  7. url: https://raw.githubusercontent.com/spinnaker-plugin-examples/examplePluginRepository/master/plugins.json

Add the plugin

  1. hal plugins add Armory.RandomWaitPlugin --version=1.1.14 \
  2. --enabled=true --extensions=armory.randomWaitStage

Next, configure the plugin. Edit your Halconfig to add the defaultMaxWaitTime in the config section:

  1. spinnaker:
  2. extensibility:
  3. plugins:
  4. Armory.RandomWaitPlugin:
  5. id: Armory.RandomWaitPlugin
  6. enabled: true
  7. version: 1.1.14
  8. extensions:
  9. armory.randomWaitStage:
  10. id: armory.randomWaitStage
  11. enabled: true
  12. config:
  13. defaultMaxWaitTime: 60
  14. repositories:
  15. examplePluginsRepo:
  16. url: https://raw.githubusercontent.com/spinnaker-plugin-examples/examplePluginRepository/master/plugins.json

Note: As of Spinnaker 1.23.0, listing extensions has been deprecated and configuration has been simplified. Plugin extension configurations have been moved and are now nested under the plugin itself. See an example of the changes here

Add deck-proxy to gate-local.yml

Beginning in Spinnaker 1.20, Gate needs to know where to get any plugin that has a Deck component. If your plugin is backend only, you do not need to modify gate-local.yml.

You can create or find gate-local.yml in the directory where Halyard stores local config files. This is usually ~\.hal\default\profiles on the machine where Halyard is running. Add the following snippet:

  1. spinnaker:
  2. extensibility:
  3. deck-proxy:
  4. enabled: true
  5. plugins:
  6. Armory.RandomWaitPlugin:
  7. enabled: true
  8. version: 1.1.14
  9. repositories:
  10. examplePluginsRepo:
  11. url: https://raw.githubusercontent.com/spinnaker-plugin-examples/examplePluginRepository/master/plugins.json

The plugin and repository information is a subset of the entries in your Halconfig.

Redeploy Spinnaker

  1. hal deploy apply

Access the RandomWait plugin in the UI

The RandomWait stage appears in the Type select list when you create a new Pipeline stage.

Random Wait stage in Type select list

Random Wait stage in Type select list

Random Wait stage after it has been selected and the configuration panel is visible.

Random Wait stage after it has been selected and the configuration panel is visible.

Troubleshooting

If the plugin doesn’t appear in the Type select list, check the following logs:

  • Orca, for the plugin backend

    You should see output similar to this when the plugin has been successfully loaded:

    1. 2020-07-02 16:12:43.284 INFO 1 --- [ main] com.netflix.spinnaker.orca.Main : [] Starting Main v1.0.0 on spin-orca-7466444f64-cg5gd with PID 1 (/opt/orca/lib/orca-web.jar started by spinnaker in /)
    2. 2020-07-02 16:12:54.691 INFO 1 --- [ main] org.pf4j.DefaultPluginManager : [] PF4J version 3.2.0 in 'deployment' mode
    3. 2020-07-02 16:12:59.088 INFO 1 --- [ main] .k.p.u.r.s.LatestPluginInfoReleaseSource : [] Latest release version '1.1.14' for plugin 'Armory.RandomWaitPlugin'
    4. 2020-07-02 16:12:59.091 INFO 1 --- [ main] .k.p.u.r.s.SpringPluginInfoReleaseSource : [] Spring configured release version '1.1.14' for plugin 'Armory.RandomWaitPlugin'
    5. 2020-07-02 16:12:59.103 INFO 1 --- [ main] p.u.r.s.PreferredPluginInfoReleaseSource : [] No preferred release version found for 'Armory.RandomWaitPlugin'
    6. 2020-07-02 16:12:59.620 INFO 1 --- [ main] org.pf4j.util.FileUtils : [] Expanded plugin zip 'orca.zip' in 'orca'
    7. 2020-07-02 16:12:59.643 INFO 1 --- [ main] org.pf4j.util.FileUtils : [] Expanded plugin zip 'Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.14.zip' in 'Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.14'
    8. 2020-07-02 16:12:59.652 INFO 1 --- [ main] org.pf4j.util.FileUtils : [] Expanded plugin zip 'orca.zip' in 'orca'
    9. 2020-07-02 16:12:59.653 INFO 1 --- [ main] org.pf4j.AbstractPluginManager : [] Plugin 'Armory.RandomWaitPlugin@unspecified' resolved
    10. 2020-07-02 16:12:59.658 INFO 1 --- [ main] org.pf4j.AbstractPluginManager : [] Start plugin 'Armory.RandomWaitPlugin@unspecified'
    11. 2020-07-02 16:12:59.659 INFO 1 --- [ main] i.a.p.s.wait.random.RandomWaitPlugin : [] RandomWaitPlugin.start()

    If you see log output similar to

    1. Plugin 'Armory.RandomWaitPlugin@unspecified' requires a minimum system version of orca>=8.0.0, and you have 1.0.0
    2. 2020-07-01 16:52:13.170 WARN 1 --- [ main] org.pf4j.AbstractPluginManager : [] Plugin '/opt/orca/plugins/Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.13/orca' is invalid and it will be disabled

    …your plugin doesn’t work with the version of Spinnaker you are using. Contact the plugin’s developer.

    If you see this.pluginId must not be null, the plugin manifest file is missing values. Contact the plugin’s developer.

  • Gate, for the plugin frontend

    You should see output similar to this when the plugin has been successfully loaded:

    1. 2020-07-02 16:12:51.994 INFO 1 --- [ main] .k.p.u.r.s.LatestPluginInfoReleaseSource : Latest release version not found for plugin 'Armory.RandomWaitPlugin'
    2. 2020-07-02 16:12:51.997 INFO 1 --- [ main] .k.p.u.r.s.SpringPluginInfoReleaseSource : Spring configured release version '1.1.14' for plugin 'Armory.RandomWaitPlugin'
    3. 2020-07-02 16:12:52.002 INFO 1 --- [ main] p.u.r.s.PreferredPluginInfoReleaseSource : No preferred release version found for 'Armory.RandomWaitPlugin'
    4. 2020-07-02 16:12:52.644 INFO 1 --- [ main] org.pf4j.util.FileUtils : Expanded plugin zip 'Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.14.zip' in 'Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.14'
    5. 2020-07-02 16:12:52.645 WARN 1 --- [ main] c.n.s.k.p.bundle.PluginBundleExtractor : Downloaded plugin bundle 'Armory.RandomWaitPlugin-pf4jStagePlugin-v1.1.14.zip' does not have plugin for service: gate

    If Gate can’t find your frontend plugin, make sure the entries in gate-local.yml are correct.

Last modified May 4, 2021: Port PR 2142 (a313cec)