SCP file transfer not working in GitLab-CI

146 Views Asked by At

I am building a CICD pipeline using GitLab-CI.

The final stage of my pipeline transfers files from the build server (where the gitlab-runner.exe is installed) to the dev server. (Both build and dev servers are Windows Server 2019, by the way).

The gitlab-runner.exe uses the PowerShell executor, so each job is just a series of PowerShell commands to be run from the build server.

All the jobs work fine, except for the file transfer, which is a simple job like this:

transfer_job
    stage: transfer
    script:
        - scp C:\folder-to-copy\ admin@ipv4-of-dev-server:C:\destination

I've set up OpenSSH Client and Server on the build and dev server respectively, and set up key-based authentication between them.

Manually, I can SCP and SSH from the build server to the dev server just fine and without password authentication required.

But when a simple SCP command in the job above is run by the gitlab-runner.exe in a pipeline, it just doesn't complete. The pipeline does not fail, it just remains on that job until timeout (1hr).

I even tried putting the scp command into a powershell script located on the build server, and changing the job so that it just runs the script as below:

transfer_job
    stage: transfer
    script:
        - C:\scripts\transfer-script.ps1

This also fails, with the same problem. Timeout.

All I need is a reliable way to transfer files from server to server within a reasonable amount of time.

Any help would be extremely valuable.

0

There are 0 best solutions below