copy jenkins job artifact to right destination - jenkins

I've setup two project with jenkins, the first is handled by an agent that builds a asp.net mvc project and then publish it on local file system in a folder that is called publish/customername.
the second job run on customer machine and copy the artifact folder in the application directory and restart iis.
The problem is that when i copy the files it replicate the directory structure like
c:/webs/vhost/project/publish/customername
instead what i want to achieve is to copy all files in
c:/webs/vhost/project
Thanks for the help

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.

Jenkins copy artifacts from another project

I moved a job that does an update function from one project to another. Under the configure option i used the copy artifacts from another project and updated the tab with the project name from which project it needs to pull files from and hit save. When i run build on the job, it does not pull the files that it needs to from the intended project and the build fails. Am i missing anything on this?

Can we create TFS build definition of website without .proj file

I am using TFS 2015 for creating builds of application. I am able to create build template for web application as web application have both .sln and .proj.
But for Websites, I only have .sln file and no .proj.
How can I create Build definition in TFS 2015 for website having only .sln file?
As #Cece said, the answer is yes, you can run the MSBuild on the server without a .csproj.
I am assuming that your project is not running on the final version of the .Net Framework. In your case I suggest you to make this change
https://stackoverflow.com/a/42493822/819153
Then you should copy all the files from the PrecompiledWeb folder, and there you should find your .sln
Sometimes there are vb/cs projects that I have seen that they do not come with a project file, csproj or vbproject. They run with the .NET Framework 2.0. For those, you can create a build definition just to compile the .sln, but when you deploy the application, you need to copy the entire PrecompiledWeb folder to the IIS folder on your server. Try to add the task that has the option copy and publish and put all the changes to your server.
Check the privilege of the folder where you want to put the files, and be sure that the agent that is running the builds on the TFS has access READ/WRITE access to the server folder.
In your case, please check the .sln file, inside of it you should have a TargetPath, by default is PrecompiledWeb, but sometimes when you run the msbuild on the tfs you end with an error saying that the PrecompiledWeb can't be on the same tree of your solution, what you need to do then is putting a level up of your solution folder
Debug.AspNetCompiler.TargetPath = "..\..\PrecompiledWeb\YourProject"
Then on your CopyTask you need to change the CopyRoot directory, if you made any transformation before your build step to the webconfig, those transformations will be reflected on the PrecomiledWeb\YourProject. All the files in that folder should be deployed to the server folder path.
Lets say that you have this structure in your Branch
Branch/MyProject, then after you compile the source code on the TFS, your precompiled folder will be stored at the same level of your project on the agents folder. Please see the picture below to get the idea how to copy the files from the PrecompiledWeb.
The answer is Yes. You can create a build definition for a WebSite project by specifying the .sln file.

Where will Build Go

I am thinking to use team city for a TFS project. I created team city configurations using TFS server. It is started and creating builds as usual. I was thinking to make the builds for my local version of TFS checked out directory before putting it live. Can anyone please suggest where my current builds are going and can I do something what I am thinking.
help please !!
There is a working directory, the same as TFS build agent working directly.
Agent work directory is the directory on a build agent that is used as
a containing directory for the default checkout directories. By
default, this is the Build agent home /work directory.
To modify the default directory location, see workDir parameter in
Build Agent Configuration.
Source: Agent Work Directory
To change this checkout location, you just need to change the workDir=../work of the buildagent.properties file (which stored in the /conf/)

TFS Build Template Copy Directory and Exclusion of files

I have TFS Build Default Template and I added to it, between "Run on Agent' and "Check In Gated Changes for CheckInShelveset Builds", Copy Directory with Source BuildDetail.DropLocation and destination a shared directory on a server.
My problem comes that the Copy Directory is not executed or is executed, but no files are copied.
I am not sure if this is the right location to place this activity, but as I read the tutorial in msdn it seems correct. How can I force the built version of the web site be copied in a specific directory, and on a separate note is there a way to exclude some files from the copy? I wish to copy the built web site without copying the web.config file.
You can use copy activity which OOB and also if you use TFS 2013 default template it has post build activity which can run powershell

Resources