Use Drone plugins
Drone plugins are Docker containers that perform predefined tasks.
Drone plugins are Docker containers that perform predefined tasks. You can use the Plugin step to run plugins from the Drone Plugins Marketplace in your Harness CI pipelines. You can also write your own custom plugins. For more information about plugins, go to Explore plugins.
Add a plugin to a Harness CI pipeline
To demonstrate how to add a Drone plugin to a Harness CI pipeline, these steps use the Download plugin as an example. This plugin downloads an archive to the stage workspace.
Add the Plugin step to the Build stage of your CI pipeline, and configure the settings as follows:
Name: Enter a name for the step.
Description: Optional description.
Container Registry: Select a Docker connector.
Image: Enter the plugin's Docker image, such as
plugins/download. You can find this on the plugin's page on the Drone Plugins Marketplace.Settings: Enter key-value pairs representing plugin settings. You can find this on the plugin's page on the Drone Plugins Marketplace or in the plugin's README.
For information about other settings, go to the Plugin step settings reference.
The following screenshot shows a Plugin step configured for the Download plugin.
Add the Plugin step to your CI stage with the following settings:
type: Pluginname:A name for the stepconnectorRef:The ID of a Docker connector.image:The plugin's Docker image, such asplugins/download. You can find this on the plugin's page on the Drone Plugins Marketplace.settings:A mapping of key-value pairs representing plugin settings. You can find this on the plugin's page on the Drone Plugins Marketplace or in the plugin's README.For information about other settings, go to the Plugin step settings reference.
The following examples show the YAML definition for a Plugin step configured for the Download plugin.
This example downloads the Drone Linux amd64 tarball. It provides a username and password for authentication to GitHub.
- step:
type: Plugin
name: drone plugin
identifier: drone_plugin
spec:
connectorRef: account.docker
image: plugins/download
settings:
source: https://github.com/drone/drone-cli/releases/download/v0.8.5/drone_linux_amd64.tar.gz ## Target to download
username: my-username ## Username for authentication to the source
password: `<+secrets.getValue("mygithubpersonalaccesstoken")>` ## Password for authentication to the sourceThis example downloads the AWS CLI for Linux and saves it to the default stage workspace directory under the name awscli.zip. Because the target is publicly accessible, authentication settings aren't required.
- step:
type: Plugin
name: drone plugin
identifier: drone_plugin
spec:
connectorRef: account.docker
image: plugins/download
settings:
source: https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip ## Target to download
destination: awscli.zip ## File name to assign the downloaded file.Expanding on this example, you could use the following commands in a subsequent Run step to unzip and install this tool:
unzip awscli.zip
sudo ./aws/installYou could also write a custom plugin that downloads, unzips, and installs the AWS CLI in one step.
Plugin settings
For information about a plugin's settings, go to the plugin's page on the Drone Plugins Marketplace. In addition to the settings described on a plugin's Marketplace page, each plugin has a README where you can read about the plugin's settings in detail. The README can include additional or uncommon settings that aren't described on the Marketplace page or the Harness CI documentation. You can find README links at the top of each plugin's Marketplace page.
Output variables
For information about output variables produced by plugins, go to Plugin step settings: Output variables.
Environment variables
Harness CI supports DRONE_ environment variables. For more information, go to the CI environment variables reference.
Plugin configuration examples
Here are some YAML examples and additional information about specific Drone plugins.
Convert Drone YAML to Harness YAML
The YAML examples in the Drone Plugins Marketplace can help you configure settings for a Plugin step in Harness CI. Many plugins offer both Harness and standalone Drone YAML samples, as indicated by the Drone/Harness toggle in the Example section.
Because Drone plugins can be used outside Harness CI, there are some differences, as explained below, in the YAML format when using Drone plugins in Harness CI versus outside Harness CI. This information focuses on the step YAML definition.
Step structure
The following examples compare the YAML structure for a step when a Drone plugin is used in a Drone pipeline and a Harness CI pipeline.
Listed and nested settings
To convert list-formatted settings from Drone Plugin YAML to Harness CI YAML, merge them with comma separation.
For nested settings, maintain key-value pair definitions, as shown in the following Harness CI YAML example:
It's often easier to define complex settings in the Harness Pipeline Studio's YAML editor, rather than the Visual editor.
Text secrets
The following snippets illustrate the different ways that Drone and Harness CI handle text secrets.
Last updated
Was this helpful?