Skip to content

dagucloud/rclone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dagu Rclone Action

Official Dagu action for running rclone commands.

This action packages the rclone CLI as a versioned Dagu action, so workflows can copy, sync, check, list, and manage files across rclone-supported storage backends without adding storage-specific executors to the Dagu core binary.

Usage

type: graph

steps:
  - id: list_files
    action: rclone@v1
    with:
      command: lsf
      source: /data/input

  - id: print
    depends: [list_files]
    run: printf '%s\n' '${list_files.outputs.stdout}'

The action returns a JSON output object. Use ${step.outputs.stdout} for small listings or command output. For large listings, exports, or command logs, write to an artifact instead of routing the data through action outputs.

Copy Files

steps:
  - id: copy_to_backup
    action: rclone@v1
    with:
      command: copy
      source: /data/reports
      destination: backup:reports
      checksum: true
      transfers: 4

copy does not delete extra files from the destination. Use it when the destination should accumulate or update files without mirroring deletions.

Sync Files

sync can delete destination files that do not exist in the source. The action requires allowDestructive: true unless dryRun: true is set.

steps:
  - id: preview_sync
    action: rclone@v1
    with:
      command: sync
      source: /data/reports
      destination: backup:reports
      dryRun: true

  - id: run_sync
    depends: [preview_sync]
    action: rclone@v1
    with:
      command: sync
      source: /data/reports
      destination: backup:reports
      allowDestructive: true

Rclone's own documentation warns that sync can cause data loss and recommends testing with --dry-run or interactive mode first.

Rclone Configuration

Use configPath to pass an rclone config file:

steps:
  - id: copy_with_config
    action: rclone@v1
    with:
      command: copy
      configPath: /run/secrets/rclone.conf
      source: /data/reports
      destination: backup:reports

You can also pass rclone environment variables explicitly with env. This is useful for config supplied by Dagu secrets:

secrets:
  - name: RCLONE_CONFIG_BACKUP_TYPE
    provider: env
    key: RCLONE_CONFIG_BACKUP_TYPE
  - name: RCLONE_CONFIG_BACKUP_PROVIDER
    provider: env
    key: RCLONE_CONFIG_BACKUP_PROVIDER

steps:
  - id: about_backup
    action: rclone@v1
    with:
      command: about
      source: backup:
      env:
        RCLONE_CONFIG_BACKUP_TYPE: ${RCLONE_CONFIG_BACKUP_TYPE}
        RCLONE_CONFIG_BACKUP_PROVIDER: ${RCLONE_CONFIG_BACKUP_PROVIDER}

Do not put literal credentials in the DAG file. Use Dagu secrets, mounted secret files, or worker environment variables.

Filters and Extra Arguments

Common filters are first-class inputs:

steps:
  - id: copy_filtered
    action: rclone@v1
    with:
      command: copy
      source: /data
      destination: backup:data
      include:
        - "*.csv"
      exclude:
        - "tmp/**"

Use extraArgs for rclone flags that are not modeled directly. Values are passed as process arguments, not through a shell.

steps:
  - id: copy_empty_dirs
    action: rclone@v1
    with:
      command: copy
      source: /data/input
      destination: backup:input
      extraArgs:
        - --create-empty-src-dirs

Destructive Commands

The action treats these commands as destructive:

  • sync
  • move
  • moveto
  • rmdir
  • delete
  • purge

They fail unless either dryRun: true or allowDestructive: true is set.

Large Output and Artifacts

The action captures stdout and stderr into ${step.outputs.stdout} and ${step.outputs.stderr} up to maxOutputBytes bytes each. The default capture limit is 1 MiB.

For large listings, attach rclone stdout directly to an artifact by calling the pinned CLI in a normal step:

type: graph

tools:
  - rclone/rclone@v1.74.1

steps:
  - id: list_large_tree
    run: rclone lsf backup:reports --recursive
    stdout:
      artifact: rclone/reports.txt

This keeps large output out of Dagu output variables while preserving it in the run's Artifacts tab.

Inputs

Name Type Required Default Description
command string Yes - rclone command to run.
source string Command-dependent - Source path or remote.
destination string Command-dependent - Destination path or remote.
configPath string No - Path passed with --config.
workdir string No action workspace Directory to cd into before running rclone.
dryRun boolean No false Add --dry-run.
allowDestructive boolean No false Required for destructive commands unless dryRun is true.
checksum boolean No false Add --checksum.
fastList boolean No false Add --fast-list.
verbose boolean No false Add -v.
stats string No - Value for --stats, such as 30s or 0.
logLevel string No - DEBUG, INFO, NOTICE, or ERROR.
transfers integer No rclone default Value for --transfers.
checkers integer No rclone default Value for --checkers.
include string[] No - Repeated --include patterns.
exclude string[] No - Repeated --exclude patterns.
filter string[] No - Repeated --filter rules.
extraArgs string[] No - Additional rclone flags passed after the command and before paths.
env object No - Extra environment variables exposed to rclone.
maxOutputBytes integer No 1048576 Maximum stdout and stderr bytes captured into action outputs.

Outputs

Name Type Description
ok boolean true when rclone exits with code 0.
command string rclone command that was run.
stdout string Captured rclone stdout, truncated at maxOutputBytes.
stderr string Captured rclone stderr, truncated at maxOutputBytes.
stdoutTruncated boolean Whether stdout capture was truncated.
stderrTruncated boolean Whether stderr capture was truncated.
durationMs integer Wrapper-measured command duration in milliseconds.
exitCode integer rclone process exit code.
error string Error message when validation or rclone execution fails.

Local Development

Use source: to call a local checkout:

steps:
  - id: list
    action: source:file:///path/to/rclone@local
    with:
      command: lsf
      source: .

Sources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors