Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar: empty archive #169

Open
frederickbeaulieu opened this issue Mar 12, 2024 · 12 comments
Open

tar: empty archive #169

frederickbeaulieu opened this issue Mar 12, 2024 · 12 comments

Comments

@frederickbeaulieu
Copy link

I get tar: empty archive when using the SCP action inside my Gitea Runner deployed in a docker container.

I tried to use folder structure used in this repository and the exact action definition, but no success.

image

image

@scillidan
Copy link

scillidan commented Mar 21, 2024

I had the same problem.
My action runs well before. Recently, I re-created my repo. On my PC, I need to use ssh -o StrictHostKeyChecking=no VPSuser@MyIp to log in VPS.
And when I used the same configuration with Github Actions, it failed.

My config:

- name: Checkout
  uses: actions/checkout@v4
- name: Get changed files
  id: changed-files
  uses: tj-actions/changed-files@v35
  with:
    since_last_remote_commit: true
    separator: ","
- name: copy file to server
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.VPS_HOST }}
    username: ${{ secrets.VPS_USERNAME }}
    key: ${{ secrets.VPS_KEY }}
    # password: ${{ secrets.VPS_PASSWORD }}
    port: ${{ secrets.VPS_PORT }}
    source: "./html/*"
    target: /var/www/sub-domains/byya/

And when I use password, it return:

Run appleboy/scp-action@v0.1.7
...
drone-scp version: v1.6.14
tar all files into /tmp/ucUfUXaNUK.tar.gz
remote server os type is unix
scp file to server.
20[24](https://github.com/scillidan/BYYA-site/actions/runs/8122976226/job/22203873158#step:14:25)/03/02 14:53:48 error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
drone-scp error: error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

When I use ssh-key, it return:

Run appleboy/scp-action@v0.1.7
...
drone-scp version: v1.6.14
tar all files into /tmp/ySUWcqCQnb.tar.gz
tar: empty archive
exit status 1

@ZachSARAO
Copy link

I've been using this action for about 4 years now - it's been helpful. I always, always, always struggle to get the source / target to work correctly as I'm never sure what directories should exist on the target, or what other rules are. The 'empty archive' message isn't helpful. Would it be possible to please improve the logging so that we know what the target directory is at runtime?

@ddjerqq
Copy link

ddjerqq commented Apr 20, 2024

this really needs improving, its really misleading and a horrible error message, how could we improve the error message? are there are any issues open addressing this?

@LucasRomier
Copy link

I am having the same problem, changing the tar_tmp_path is not registered either

@ddjerqq
Copy link

ddjerqq commented Jun 12, 2024

I fixed this issue, the problem was with paths, if anyone else is having issues, Please make sure your paths are correct! the trailing and leading slashes matter. The action does not give clear error messages.

here are some examples of how I am using this action after fixing the issue:

- name: Copy the source to the server 🔁
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.SSH_HOST }}
    username: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}
    source: "."
    target: "~/src"
    overwrite: true
    strip_components: 1
- name: Copy dist content to server 🔁
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.SSH_HOST }}
    username: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}
    source: "./dist/wwwroot/*"
    target: "~/dist/"
    rm: true
    overwrite: true
    strip_components: 2

Notice the slashes, and the home directory!
make sure the directory you're SCP-ing to exists on the remote machine. Make sure you have correct permissions. If you still cant get it to work @ me. I will help you! Good luck

@mabonfanti
Copy link

@ddjerqq what if I want to transfer a xml file from a remote windows server into my workspace? I have been using this but I keep getting the empty file error message:

image

This is my code:

image

@ddjerqq
Copy link

ddjerqq commented Aug 27, 2024

it is an issue with path names of the files, fix it, use absolute path names, please refer to this guide about scp https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/

@mabonfanti
Copy link

mabonfanti commented Aug 28, 2024

@ddjerqq I think my issue is that I want to do a copy from a Windows server into the github workspace:

  • name: Pull Appman from rsapns0001 server
    uses: appleboy/scp-action@master
    with:
    host: ${{ env.WINDOWS_SERVER_HOST }}
    username: ${{ env.WINDOWS_DEPLOY_USER }}
    key: ${{ secrets.SSH_PRIVATE_KEY }}
    port: 22
    source: "/D:/ResApps/prodbase/x86/appman/appman.xml"
    target: /github/workspace/

In that example the Windows Server Host is the source where the XML file is and I need to copy that one from there into my workspace to then do an update and sent it back to the server updated. Do you know if the scp works both ways? Does it support scp files from target host to drone itself?

@Cow258
Copy link

Cow258 commented Oct 12, 2024

Please make sure your runner's /tmp is mounted to Docker host's /tmp

https://github.com/orgs/community/discussions/141270#discussion-7310106

@alper
Copy link

alper commented Oct 26, 2024

I get empty archive. Can I debug it? It doesn't even print out the paths it's trying to add to the archive.

@ddjerqq
Copy link

ddjerqq commented Oct 27, 2024

@alper can you share your file paths on the gha runner, and the server?
i have ran into issues when:

  • the paths didnt match
  • i was trying to send a tar file
  • the host did not have the directory i was trying to copy to

and you can check out this comment on how to use SCP without this GHA

@alper
Copy link

alper commented Oct 30, 2024

I got it to work finally but all the path mismatches were really awful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants