milanmk / actions-file-deployer

Composite GitHub Action (Linux runner) for deploying repository content to remote server. Fast and customizable deployment with proxy support. Deploy only changed files or do full sync/mirror of repository content.
The Unlicense
62 stars 14 forks source link

Invalid synchronization: . Valid types are 'delta' and 'full'. #12

Open khertg opened 2 years ago

khertg commented 2 years ago

image

milanmk commented 2 years ago

Please check if sync input value does not have leading/trailing space.

mattlag commented 2 years ago

I'm getting this too: image

From the .yaml: image

no trailing/leading spaces. Tried both "delta" and "full". The error seems to not know what the value is, there is a : then a . but no erroneous value Invalid synchronization: .

milanmk commented 2 years ago

Could you please share action log after enabling debug input parameter.

mattlag commented 2 years ago

Here are the logs, although it worked today:

logs_13.zip

milanmk commented 2 years ago

@mattlag Thank you for providing action logs. It the same workflow did ran properly then I am guessing it was a temporary glitch with action runner.

mattlag commented 2 years ago

Thanks for being responsive, but I used it all yesterday with no problems 👍

thomasmillercf commented 1 year ago

@milanmk

I have encountered this issue and found the cause ,well for my problem anyway. When trigging the deployment via a repo dispatch the following worked, however when trying to run the workflow manually, it would have the same issue as above.

The following is a cutdown example.

on:
  repository_dispatch:
    types: [production-release]
  workflow_dispatch:

.....

    - name: Deploy assets library to netstorage (CDN)
      uses: milanmk/actions-file-deployer@1.11
      with:
        remote-protocol: 'sftp'
        remote-host: ${{ inputs.cdnRemoteHost }}
        remote-user: 'sshacs'
        ssh-private-key: ${{ inputs.cdnPrivateKey }}
        remote-path: ${{ inputs.cdnRemotePath }}
        local-path: asset
        sync: full
        ssh-options: '-oHostKeyAlgorithms=+ssh-dss'
        ftp-options: 'set cmd:fail-exit true'

The root cause of my issue was that the input_sync expects the sync input to come from the workflow inputs when I manually trigger the workflow.

Basically my input was being overridden by the default input.sync

 input_sync=${{inputs.sync}}
        if [ "${{github.event_name}}" == "workflow_dispatch" ]; then
          input_sync=${{github.event.inputs.sync}}
fi
milanmk commented 1 year ago

You should have an input for workflow_dispatch like shown in the readme workflow example.

workflow_dispatch:
  inputs:
    sync:
      description: "File synchronization"
      required: true
      default: "delta"
thomasmillercf commented 1 year ago

I would argue that it's a flaw to have 2 ways to provide the sync where one overrides the other depending on how the workflow is triggered.

It should be changed so you do not need to provide a workflow_dispatch as not everyone wants to have a workflow dispatch as they would rather just provide what is required for the action in the usage of the action.

Or at the very least the error message needs to be clear, ie go read this bit of the docs which explains why I am getting this error.
As Invalid synchronization: . Valid types are 'delta' and 'full' is not helpful when you think you are providing it.

tswaehn commented 1 year ago

I am trying this with manual trigger of the github action.

I do set sync in the settings:

      - name: sftp deploy
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-port: 22
          remote-host: ${{ secrets.DEPLOY_HOST }}
          remote-user: ${{ secrets.DEPLOY_USER }}
          remote-password: ${{ secrets.DEPLOY_PASS }}
          proxy: false
          sync: "full"
          local-path: "./public/*"
          remote-path: "test""

which leads to Invalid synchronization: . Valid types are 'delta' and 'full'

however when I additionally add sync to the input settings:

  workflow_dispatch:
    inputs:
      sync:
        description: "File synchronization"
        required: true
        default: "full"

it seems to work.

Why do I have to set sync twice?