How can we copy or download files from windows share path(UNC) to linux servers in Azure Devops tool/TFS? - tfs

I am trying to copy war and ear files from windows share path(UNC) to linux target servers where jboss jvm is running and then deploy these files using our custom script. this is for applications that are still not using tfs to do their build. i tried download from file share task in azure devops but that is only copying to the agent location but not to the target server. if anyone has come across this situation and found a solution please do share your thoughts. appreciate it. thanks.

You need to use two tasks/steps to handle this situation.
Copy/download files from windows share path(UNC) to a folder path in build agent machine, such as $(Agent.BuildDirectory)
Copy files from a source folder to a target folder on a remote Linux server machine over SSH.
Since you have successfully download from file share task in Azure DevOps to agent machine. Then you just need to use Copy Files Over SSH task.
Use this task in a build or release pipeline to copy files from a
source folder to a target folder on a remote machine over SSH.
This task allows you to connect to a remote machine using SSH and copy
files matching a set of minimatch patterns from specified source
folder to target folder on the remote machine. Supported protocols for
file transfer are SFTP and SCP via SFTP. In addition to Linux, macOS
is partially supported.
More detail configuration about this task please refer official link here-- Copy Files Over SSH task

Related

Jenkins Publish Over SSH: How to give windows directory(Eg: E:\Test\SFTP\In\Test.txt) in Source file and remote UNIX directory in Remote directory

Can some please help me using the directory structure in the Jenkins job for sending files to the remote ssh server?
Jenkins Publish Over SSH: How to give windows directory(Eg: E:\Test\SFTP\In\Test.txt) in source file and Remote directory in unix(/data/xyz/test/sftp/In)
enter image description here
If I understood you correctly, you want to publish a file from your build server (windows) to you remove server (UNIX) ?
In that case you could do the following.
When jenkins builds your package, it will build it in your project workspace folder which is located in your jenkins working directory.
If you want to deploy everything that is on there you can set / in your source files field in which case it will take all files and all directories
and will publish it to the desired path on the remote server. On this example it publishes it to /usr/share/nginx/html but in your case it would be /data/xyz/test/sftp/In
Something quite important, depending on your configuration, sometimes it considers the given path as relative to the jenkins home path so either make ~/data/xyz/test/sftp/In or data/xyz/test/sftp/In.

Is it possible to access files from the Build Agent container in the TeamCity UI?

I have a build steps that zips up files into a folder that I want to be able to download onto my local machine. The folder as of now gets zipped into the Build Agent that's running in a container.
Is there a way to download this folder from the TeamCity UI, instead of doing docker commands to get it from inside the container?
You can configure and use Build artifact

TFS build to create workspace in NetworkSharedPath

Currently my TFS build is creating the workspace in build machine and all my remaining task are performed in a network share in UNIX machine. So i copy my workspace to that network share before proceeding with the build. Is there any way to directly create the workspace in NetworkShare, so that i can stop copying process.
If you mean the UNIX project have dependencies which generated on windows build, I am afraid you have to add a copy task to copy them first, unless you can build the windows and UNIX projects on the same agent, but generally it's not possible.
However if you want to build them on a network shared path, then you just need to deploy a new build agent and set the network path as the working folder. Thus you can directly reference the dependencies on the shared path.

Artifact "Windows Machine File Copy" task configure properly

I just tried to automate my build process. So tried to add Windows Machine File Copy task for artifact (Release Definition)
This DevOpsBuild artifact has 3 environment as seen on the picture.
So I added Windows Machine File Copy task to copy the files from my published folder
\localhost\NewBuildDropLocation\$(Build.DefinitionName)\$(Build.BuildNumber)/drop/MVCWebApplication/MVCWebApplication
So as example
\localhost\NewBuildDropLocation\DevOpsBuild\20180427.3\drop\MVCWebApplication\MVCWebApplication
here the image of above settings
then after I create release for this artifact, it's stuck "In Progress" phase not going for other phases.
I'm using localhost environment for all these task. I'm newbie to DevOps, followed this tutorial
localhost is the machine the agent is running on.
The source parameter should be the location of the build artifacts, which is usually $(System.DefaultWorkingDirectory), or some subfolder of that. See the documentation for more details.
The Machines parameter should be an actual hostname for a server on your network.
Also note that if you're using the Hosted agent, none of this is going to work -- if you're deploying to on-prem servers, the servers have to be network-accessible by the agent. The hosted agent is run by Microsoft and lives in the cloud and definitely doesn't have access to your servers. You'll need to configure a private agent.

Jenkins : Windows build to Windows host : which plugin to use?

I have found many examples of Linux to Windows or OSX to Windows, but battling to find how to copy build files from a Windows server installation of Jenkins, to the
Windows server which will host the website.
I tried Copy Artifact Plugin - but it seems this is used to copy other builds into the current build - is this correct?
Or can it be used to copy the build that just execute to a remote Windows folder?
What should I use to copy to another Windows server?
I would like to not use batch files. Can/should powershell be used?
The idea would be to copy the files to a timestamped folder on the hosting Windows server
e.g.
xcopy *.* \\MyHostingServer\Temp
Then only after everything has copied successfully - to copy the files from MyHostingServer\Temp into the correct web folder. This is to prevent the deployment to the web folder if e.g. network connection was lost halfway.
I am having a really hard time getting Windows specific information.
I suggest to use two jobs:
build job is running on the first Windows server. Archive your build files as an artifacts to the job
deployment job should run on second Windows server. You can use "Copy artifacts from another project" to get your build files locally (on second server)

Resources