Jenkins transferring 0 files using publish over SS

2019-01-14 07:06发布

I want to transfer files from my post build Jenkins workspace to a location on a remote server. Build goes smoothly for all steps in the job but always transfers 0 files.

This is the console output:

    Started by user Patrick
    Building in workspace /var/lib/jenkins/jobs/20eyes Build/workspace
    Fetching changes from the remote Git repository
    Fetching upstream changes from https://github.com/project/project.git
    using .gitcredentials to set credentials
    Checking out Revision a758e0f8e534271b999a2fc8696b6fd5a3d5e500 (origin/master)
    executing script:

    cd /var/www/20eyes-web
    [SSH] exit-status: 0
    SSH: Connecting from host [dev1.remotehost]
    SSH: Connecting with configuration [dev2.remotehost] ...
    SSH: Disconnecting configuration [dev2.remotehost] ...
    SSH: Transferred 0 file(s)
    Build step 'Send files or execute commands over SSH' changed build result to  SUCCESS
    Finished: SUCCESS

The job is configured to build after any commit is pushed to GitHub

The transfer set is: Source Files:

/var/lib/jenkins/jobs/20eyes Build/workspace/**/*

Remove prefix:

/var/lib/jenkins/jobs/20eyes Build/workspace

4条回答
男人必须洒脱
2楼-- · 2019-01-14 07:14

My advices:

  1. You should avoid using spaces in the Jenkins job name!
    • in your case: name 20eyes Build can produce some troubles in file/directory matching
  2. You should use relative paths and not absolute paths!
    • in your case: /var/lib/jenkins/... should be replaced by relative path from job's workspace
  3. You should NOT copy whole workspace!
    • specify only appropriate files from last build (e.g. WAR file from target directory)
  4. You should check documentation and examples of Publish Over plugins:
查看更多
唯我独甜
3楼-- · 2019-01-14 07:31

In my case I was using the absolute path(from root) in "Transfer Set Source Files:". When I changed the path relative to the workspace, It worked!

查看更多
Juvenile、少年°
4楼-- · 2019-01-14 07:34

I thinks, problem at your config. We have 2 positions to configure.

  1. At System configuration (Global config). --> If test ok ==> Configuration to remote server is ok.
  2. At your project. We will focus about transfer set: (Source file, Remove prefix, remote directory)

    2.1 Source file : if it's blank = workspace directory. in your case i think you should input **/*
    2.2 Remove prefix : refer Here for more info.
    2.3 Remote directory: if it's blank = directory that is configured at System configuration above.

Hope it help! Sorry about my English.

查看更多
Summer. ? 凉城
5楼-- · 2019-01-14 07:35

Quick thing to try first: set the Source folder only with: **/* to see if any file is copied. If file was copied then take a look here to see how to write the correct path here

查看更多
登录 后发表回答