Octopus.Script exported 2020-06-15 by ryanrousseau belongs to ‘File System’ category.
Run rsync 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
Rsync.Path =
Optional path to rsync
if it is not in the environment’s path variable.
Source
Rsync.Source =
The location of the source files to copy.
Destination
Rsync.Destination =
The destination to copy the source files to.
Print Command?
Rsync.PrintCommand =
Prints the command in the logs using set -x
. This will cause a warning when the step runs.
Script body
Steps based on this template will execute the following Bash script.
rsyncPath=$(get_octopusvariable "Rsync.Path")
rsyncOptions=$(get_octopusvariable "Rsync.Options")
rsyncSource=$(get_octopusvariable "Rsync.Source")
rsyncDestination=$(get_octopusvariable "Rsync.Destination")
printCommand=$(get_octopusvariable "Rsync.PrintCommand")
if [ ! -z "$rsyncPath" ] ; then
PATH=$rsyncPath:$PATH
fi
if [ "$printCommand" = "True" ] ; then
set -x
fi
rsync ${rsyncOptions:+ $rsyncOptions} ${rsyncSource:+ $rsyncSource} ${rsyncDestination:+ $rsyncDestination}
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "d8dfa484-59ed-491f-a22a-3098d4c2a6be",
"Name": "File System - rsync (bash)",
"Description": "Run [rsync](http://manpages.org/rsync) on a target or worker.",
"Version": 1,
"ExportedAt": "2020-06-15T21:11:29.969Z",
"ActionType": "Octopus.Script",
"Author": "ryanrousseau",
"Packages": [],
"Parameters": [
{
"Id": "da47b530-69dd-482c-9b97-f9c0b1dcca5c",
"Name": "Rsync.Path",
"Label": "Executable Path",
"HelpText": "Optional path to `rsync` if it is not in the environment's path variable.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "7d315721-f2b2-4f0b-8eb1-3b946f711a59",
"Name": "Rsync.Options",
"Label": "Options",
"HelpText": "[Options](http://manpages.org/rsync#options) to provide to `rsync`.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "a908f5a3-8284-42b9-992d-528993c5b55f",
"Name": "Rsync.Source",
"Label": "Source",
"HelpText": "The location of the source files to copy.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "366ad01c-1ef9-408e-bbed-58d0a7a3e4db",
"Name": "Rsync.Destination",
"Label": "Destination",
"HelpText": "The destination to copy the source files to.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "d969ceca-d823-4967-afbe-80672cd55051",
"Name": "Rsync.PrintCommand",
"Label": "Print Command?",
"HelpText": "Prints the command in the logs using `set -x`. This will cause a warning when the step runs.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "Checkbox"
}
}
],
"Properties": {
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.Script.Syntax": "Bash",
"Octopus.Action.Script.ScriptBody": "rsyncPath=$(get_octopusvariable \"Rsync.Path\")\nrsyncOptions=$(get_octopusvariable \"Rsync.Options\")\nrsyncSource=$(get_octopusvariable \"Rsync.Source\")\nrsyncDestination=$(get_octopusvariable \"Rsync.Destination\")\nprintCommand=$(get_octopusvariable \"Rsync.PrintCommand\")\n\nif [ ! -z \"$rsyncPath\" ] ; then\n \tPATH=$rsyncPath:$PATH\nfi\n\nif [ \"$printCommand\" = \"True\" ] ; then\n set -x\nfi\n\nrsync ${rsyncOptions:+ $rsyncOptions} ${rsyncSource:+ $rsyncSource} ${rsyncDestination:+ $rsyncDestination}"
},
"Category": "File System",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/file-system-rsync.json",
"Website": "/step-templates/d8dfa484-59ed-491f-a22a-3098d4c2a6be",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKhQTFRF/////78A/6oAVVVV/++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