File System - rclone (bash)

Octopus.Script exported 2020-06-15 by ryanrousseau belongs to ‘File System’ category.

Runs rclone on a target or worker.

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

Executable Path

Rclone.Path =

Optional path to rclone if it is not in the environment’s path variable.

Command

Rclone.Command =

The rclone command to run.

Parameters

Rclone.Parameters =

The parameters to provide to the rclone command.

Rclone.PrintCommand =

null

Script body

Steps based on this template will execute the following Bash script.

rclonePath=$(get_octopusvariable "Rclone.Path")
rcloneCommand=$(get_octopusvariable "Rclone.Command")
rcloneParameters=$(get_octopusvariable "Rclone.Parameters")
printCommand=$(get_octopusvariable "Rclone.PrintCommand")

if [ ! -z "$rclonePath" ] ; then
   	PATH=$rclonePath:$PATH
fi

if [ -z "$rcloneCommand" ] ; then
   	fail_step "Command is a required paremeter."
fi

if [ "$printCommand" = "True" ] ; then
    set -x
fi

rclone $rcloneCommand ${rcloneParameters:+ $rcloneParameters} 2>&1

# Check for error
if [[ $? -ne 0 ]]
then
    fail_step "The rclone command resulted in errors. Please review the logs above."
fi

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "fe8bf996-4cdf-4857-9c26-5aefb4fb4025",
  "Name": "File System - rclone (bash)",
  "Description": "Runs [rclone](https://rclone.org/) on a target or worker.",
  "Version": 1,
  "ExportedAt": "2020-06-15T21:16:20.733Z",
  "ActionType": "Octopus.Script",
  "Author": "ryanrousseau",
  "Packages": [],
  "Parameters": [
    {
      "Id": "b5c7fe5c-062e-4c69-9746-e6275f8d5145",
      "Name": "Rclone.Path",
      "Label": "Executable Path",
      "HelpText": "Optional path to `rclone` if it is not in the environment's path variable.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "aba94574-2ab4-4657-94d6-3ae47cf6cd38",
      "Name": "Rclone.Command",
      "Label": "Command",
      "HelpText": "The `rclone` [command](https://rclone.org/commands/) to run.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "ce6fa762-d494-4e3b-8367-edfced04bc45",
      "Name": "Rclone.Parameters",
      "Label": "Parameters",
      "HelpText": "The parameters to provide to the `rclone` command.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "7647af01-707d-4a02-8f90-37fc943bdece",
      "Name": "Rclone.PrintCommand",
      "Label": "Print Command?",
      "HelpText": null,
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "Checkbox"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptSource": "Inline",
    "Octopus.Action.Script.Syntax": "Bash",
    "Octopus.Action.Script.ScriptBody": "rclonePath=$(get_octopusvariable \"Rclone.Path\")\nrcloneCommand=$(get_octopusvariable \"Rclone.Command\")\nrcloneParameters=$(get_octopusvariable \"Rclone.Parameters\")\nprintCommand=$(get_octopusvariable \"Rclone.PrintCommand\")\n\nif [ ! -z \"$rclonePath\" ] ; then\n   \tPATH=$rclonePath:$PATH\nfi\n\nif [ -z \"$rcloneCommand\" ] ; then\n   \tfail_step \"Command is a required paremeter.\"\nfi\n\nif [ \"$printCommand\" = \"True\" ] ; then\n    set -x\nfi\n\nrclone $rcloneCommand ${rcloneParameters:+ $rcloneParameters} 2>&1\n\n# Check for error\nif [[ $? -ne 0 ]]\nthen\n    fail_step \"The rclone command resulted in errors. Please review the logs above.\"\nfi\n"
  },
  "Category": "File System",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/file-system-rclone.json",
  "Website": "/step-templates/fe8bf996-4cdf-4857-9c26-5aefb4fb4025",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKhQTFRF/////78A/6oAVV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