简体   繁体   中英

How to upload zip file on remote server using Azure DevOps

I am using Azure Deveops for build and release my MVC website to the different client machines. I was successfully able to build and release .Net Core application to the remote server but with that I also want to upload some initial file which contains.json files that I want to upload on remote server (client's machine).

What I have tried

I have tried to used Windows Machine File Copy task and Copy Files task , but this didn't work for me.

Please provide me suggestions or solution to upload files on remote server using Azure devops.

I have used several of these types of tasks:

Alternatively, use a script task and write the command you want to use. I had a scenario where my agent was on Linux and I needed to push files to a Windows Server. I ended up using a Bash Smbclient like this:

- task: Bash@3
  displayName: "Copy/Upload file to remote server"
  inputs:
    targetType: 'inline'
    script: |
      apt-get update && apt-get install -y smbclient
      smbclient -U "$(username@my.domain)%$(password)" //my.network.server/share --directory '/path/to/location/' -c 'put myfile.zip'

Create a Deployment Group and install an agent to the target machine. When running a release, it fetches the build artifacts to the target server and you'll be able to use, for example, a normal copy task to copy the zip.

Alternative, if you just need to run the release on agent located somewhere else (hosted agent, agent running on build server, etc), you could use WinRM copy -extension to copy the files. You'd, of course, need to enable WinRM calls between the machines.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM