Sign inSign up

sinlov/woodpecker-file-browser-sync

By sinlov

Updated over 1 year ago

file sync for woodpecker-ci use https://github.com/filebrowser/filebrowser

Image
0

10K+

sinlov/woodpecker-file-browser-sync repository overview

woodpecker-file-browser-sync

Features

  • sync as github.com/filebrowser/filebrowser

    • local path will sync to remote path graph {.sync}/${repo-Hostname}/${repo-Owner}/${repo-Name}/{build-number}
  • support link choose by web test

    • file-browser-urls support multi urls, will auto switch host fast
    • file-browser-standby-url if multi urls not work, will use this
  • support dry-run mode

  • support sync mode download and upload

    • each mode support sync-include-globs and sync-exclude-globs

Settings

NameRequiredDefault valueDescription
debugnofalseopen debug log or open by env PLUGIN_DEBUG
sync-dry-runnofalsedry run, only print some info, not real sync
file-browser-urlsyesfile browser urls, support multi urls, will auto switch host fast
file-browser-usernameyesfile browser username, support from secret
file-browser-user-passwordyesfile browser password, support from secret
file-browser-standby-urlyesfile browser standby url, if multi urls not work, will use this
file-browser-standby-usernameyesfile browser standby username, support from secret
file-browser-standby-user-passwordsyesfile browser standby password, support from secret
sync-modeyessync mode, support: upload, download
sync-work-space-pathyessync path under workspace path
sync-include-globsnoinclude globs do not use with exclude globs
sync-exclude-globsnoexclude globs do not use with include globs

Hide Settings:

NameRequiredDefault valueDescription
timeout_secondno10command timeout setting by second, minimum 10s
file-browser-sync-timeout-secondno60file browser sync files timeout second, minimum 60s
woodpecker-kit-steps-transfer-file-pathno.woodpecker_kit.steps.transferSteps transfer file path, default by wd_steps_transfer.DefaultKitStepsFileName
woodpecker-kit-steps-transfer-disable-outnofalseSteps transfer write disable out

Example

  • workflow with backend docker

docker hub version semver docker hub image size docker hub image pulls

labels:
  backend: docker
steps:
  woodpecker-file-browser-sync:
    image: sinlov/woodpecker-file-browser-sync:latest
    pull: false
    settings:
      # debug: true
      # sync-dry-run: true # dry run, only print some info, not real sync
      ## connect config
      file-browser-urls:
        - https://filebrowser-inner.example.com
        - https://filebrowser.example.com
        - https://filebrowser-zone.example.com
      file-browser-username:
        from_secret: file_browser_sync_username
      file-browser-user-password:
        from_secret: file_browser_sync_password
      # standby url
      file-browser-standby-url: https://filebrowser-standby.example.com
      file-browser-standby-username:
        from_secret: file_browser_sync_standby_username
      file-browser-standby-user-passwords:
        from_secret: file_browser_sync_standby_password
      ## sync config
      sync-work-space-path: dist # sync path under workspace path, Required
      sync-mode: upload # sync mode, support: upload, download
      sync-include-globs: # include globs do not use with exclude globs
        - "**/**/*.dll"
        - "**/*.md"
  • workflow with backend local, must install at local and effective at evn PATH
  • install at ${GOPATH}/bin, latest
go install -a github.com/woodpecker-kit/woodpecker-file-browser-sync/cmd/woodpecker-file-browser-sync@latest

GitHub latest SemVer tag) GitHub release)

  • install at ${GOPATH}/bin, v1.0.0
go install -v github.com/woodpecker-kit/woodpecker-file-browser-sync/cmd/[email protected]
labels:
  backend: local
steps:
  woodpecker-file-browser-sync:
    image: woodpecker-file-browser-sync
    settings:
      # debug: true
      # sync-dry-run: true # dry run, only print some info, not real sync
      ## connect config
      file-browser-urls:
        - https://filebrowser-inner.example.com
        - https://filebrowser.example.com
        - https://filebrowser-zone.example.com
      file-browser-username:
        from_secret: file_browser_sync_username
      file-browser-user-password:
        from_secret: file_browser_sync_password
      # standby url
      file-browser-standby-url: https://filebrowser-standby.example.com
      file-browser-standby-username:
        from_secret: file_browser_sync_standby_username
      file-browser-standby-user-passwords:
        from_secret: file_browser_sync_standby_password
      ## sync config
      sync-work-space-path: dist # sync path under workspace path, Required
      sync-mode: upload # sync mode, support: upload, download
      sync-include-globs: # include globs do not use with exclude globs
        - "**/**/*.dll"
        - "**/*.md"
  • full config
labels:
  backend: docker
steps:
  woodpecker-file-browser-sync:
    image: sinlov/woodpecker-file-browser-sync:latest
    pull: false
    settings:
      debug: true
      sync-dry-run: true # dry run, only print some info, not real sync
      file-browser-sync-timeout-second: 120 # file browser sync files timeout second, minimum 60s
      ## connect config
      file-browser-urls:
        - https://filebrowser-inner.example.com
        - https://filebrowser.example.com
        - https://filebrowser-zone.example.com
      file-browser-username:
        from_secret: file_browser_sync_username
      file-browser-user-password:
        from_secret: file_browser_sync_password
      # standby url
      file-browser-standby-url: https://filebrowser-standby.example.com
      file-browser-standby-username:
        from_secret: file_browser_sync_standby_username
      file-browser-standby-user-passwords:
        from_secret: file_browser_sync_standby_password
      ## sync config
      sync-work-space-path: dist # sync path under workspace path, Required
      sync-mode: upload # sync mode, support: upload, download
      sync-include-globs: # include globs do not use with exclude globs
        - "**/**/*.dll"
        - "**/*.md"
      sync-exclude-globs: # exclude globs do not use with include globs
        - "**/node_modules/**"
        - "**/vendor/**"

Notes

  • file-browser-urls support multi urls, However, these URLs actually point to the same service, preventing files from being downloaded or uploaded normally in the same build.

  • file-browser-standby-urland related parameters can be set in the server environment variable WOODPECKER_ENVIRONMENT for use in multiple environments

WOODPECKER_ENVIRONMENT="PLUGIN_FILE_BROWSER_STANDBY_URL:https://filebrowser-standby.example.com,PLUGIN_FILE_BROWSER_USERNAME:sync-filebrowser,PLUGIN_FILE_BROWSER_STANDBY_USERNAME:sync-filebrowser"

then it can be simplified

labels:
  backend: docker
steps:
  woodpecker-file-browser-sync:
    image: sinlov/woodpecker-file-browser-sync:latest
    pull: false
    settings:
      # debug: true
      # sync-dry-run: true # dry run, only print some info, not real sync
      ## connect config
      file-browser-urls:
        - https://filebrowser-inner.example.com
        - https://filebrowser.example.com
        - https://filebrowser-zone.example.com
      file-browser-user-password:
        from_secret: file_browser_sync_password
      # standby url
      file-browser-standby-user-passwords:
        from_secret: file_browser_sync_standby_password
      ## sync config
      sync-work-space-path: dist # sync path under workspace path, Required
      sync-mode: upload # sync mode, support: upload, download
      sync-include-globs: # include globs do not use with exclude globs
        - "**/**/*.dll"
        - "**/*.md"

Known limitations

  • file-browser-standby-url is required, if file-browser-urls not work, will use this, but if file-browser-standby-url not work, will not retry.

Tag summary

Content type

Image

Digest

sha256:07c52f52f

Size

5.7 MB

Last updated

over 1 year ago

docker pull sinlov/woodpecker-file-browser-sync