Skip to main content

Use Drone plugins

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.

About Drone

Drone was acquired by Harness in 2020 and is part of Harness CI.

For more information on the acquisition of Drone, go to the following blog posts:

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 your CI stage with the following settings:

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 source
Tips

You can use variable expressions for Settings values. For example, credentials: <+stage.variables.[TOKEN_SECRET]> uses a stage variable.

Create text secrets for sensitive information, such as passwords and tokens, required by the plugin.

When you run the pipeline, check the log output to verify that the plugin works as intended.

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.

The README link is at the top of each plugin's Drone Plugin 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.

Artifact Metadata Publisher plugin

Use the artifact-metadata-publisher plugin to publish a URL of an artifact file to the Artifacts tab.

An example of the Plugin step configuration is provided below; however, your pipeline must also include steps to upload the file that you want to link to on the Artifacts tab, as demonstrated in Publish to the Artifacts tab.

               - step:
type: Plugin
name: metadata publisher plugin
identifier: metadata_publisher_plugin
spec:
connectorRef: account.harnessImage ## A Docker connector ID
image: plugins/artifact-metadata-publisher
settings:
file_urls: https://storage.googleapis.com/mybucket/index.html ## Provide a URL to the artifact you want to show on the artifact tab. You can provide a list of multiple URLs to show multiple links on the Artifacts tab.
artifact_file: artifact.txt ## Provide any '.txt' file name, such as 'artifact.txt' or 'url.txt'. This is a required setting that Harness uses to store the artifact URL and display it on the Artifacts tab. This value is not the name of your uploaded artifact, and it has no relationship to the artifact object itself.

For more information about uploading and publishing artifacts, go to Build and push artifacts and images.

GitHub Actions plugin
Jira plugin
Slack plugin

Harness has built-in notifications for email, Microsoft Teams, and Slack.

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.

You can switch between Drone YAML and Harness YAML in the Drone Plugins Marketplace.

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.

steps:
- name: download ## Step name
image: plugins/download ## Plugin's Docker image
settings: ## Plugin settings
source: https://github.com/drone/drone-cli/releases/download/v0.8.5/drone_linux_amd64.tar.gz

Listed and nested settings

To convert list-formatted settings from Drone Plugin YAML to Harness CI YAML, merge them with comma separation.

Settings:
tags:
- latest
- '1.0.1'
- '1.0'

For nested settings, maintain key-value pair definitions, as shown in the following Harness CI YAML example:

settings:
mynestedsetting:
nextlevel:
varname: 100
mylistsetting:
- itemone
- itemtwo

It's often easier to define complex settings in the Harness Pipeline Studio's YAML editor, rather than the Visual editor.

Using the Visual editor to configure Plugin settings.

Text secrets

The following snippets illustrate the different ways that Drone and Harness CI handle text secrets.

steps:
- name: download
image: plugins/download
settings:
username:
from_secret: username
password:
from_secret: password
source: https://github.com/drone/drone-cli/releases/download/v0.8.5/drone_linux_amd64.tar.gz