Create a Deployment Package to folder TeamCity - teamcity

I currently have Team City set up on a server that does:
1) Build the Project
2) Run unit tests
3) Publish the project through IIS if successful
I want to add another step so that a .zip file is produced consisting of what was deployed to a directory on the server running team city. I am to understand that this is possible through artefacts but everything I've tried so far hasn't worked to give me the publish output.
I've tried options such as "** => C:\TC\Test.zip" but that includes the actual code implementation files.
Is there a way in which to publish a zip containing the publish result?
I've been trying this for hours without luck so far so hopefully I can get an answer.

You can use this to zip all files relative to the root of the build:
**/* => artifacts.zip
To zip all files relative to a folder named publish:
publish/**/* => artifacts.zip
If your published files are not included in the zip, they may have been published to someplace outside of the root of the build.

Related

MsTest unable to copy test data files to build server

I am trying to implement automated unit testing with each build using TFS.
Problem statement :
I have created few xml files which stores test data and set to copy always. When run locally files are picked up from bin folder. When I schedule a build, build process looks for files in out folder under TestResults on Build Server. Out folder contains ddls but not the xml files. Hence unable to find files and results into build failure partially.
You can specify additional files to deploy in your test settings file:
More details here - https://msdn.microsoft.com/en-us/library/ms182475.aspx
You could also use the DeploymentItem Attribute.
https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx

how to deploy a custom sub-directory within the project with capistrano?

I couldn't find a way to do this yet with capistrano, but lets say I have a project like
project
project/src
project/Capfile
project/config/deploy.rb
project/config/deploy/production.rb
project/build
project/build/main.js
project/build/other_src.js
so the intention is to deploy only what I have within the /build sub directory within the project.
I realize I can just move the capistrano files to the build directory, but the directory is build and dropped every time I compile the project, so I need to kept the capistrano files within the root dir of the project.
Any advice on how to do it in Capistrano?
I've always deployed the entire project and then pointed my webserver at the relevant subfolder. Alternately, you can write a custom task to rework the data in the release path.

TeamCity - How to publish one output dll into many directories?

I'm trying to publish one of the output dll's to multiple artifact directories. But it seems, that teamcity is publishing that dll only to the last directory.
I would like to have something like this:
MyTool\MyTool.dll => MyZip.zip!/MyTool1/
MyTool\MyTool.dll => MyZip.zip!/MyTool2/
And on output:
MyZip.zip
MyTool1/MyTool.dll
MyTool2/MyTool.dll
But TeamCity returns me only last line:
MyZip.zip
MyTool2/MyTool.dll
Does anyone know how to publish one dll from builds output to multiple artifacts directories?
I spent some time looking for a workaround. It seems like the zip file is the sticking point. If it doesn't need to be zipped, then the following works fine:
MyTool\MyTool.dll => MyTool/MyTool1/
MyTool\MyTool.dll => MyTool/MyTool2/
Another option is to create a build step that moves the DLLs into the folder structure that you want, and then save that folder as the zipped artifact.

How to access test artifacts from Jenkins if test fails

I have a Maven project which performs a number of time consuming tests as part of the integration-test Maven cycle. I'm using Jenkins as the CI server.
During the integration test a number of files are produced in the target folder. For example, an "actual" BMP file is produced and compared to an "expected" BMP file. If the test fails, I need to look at the files in the target folder to determine how to deal with the error. Maybe the actual BMP looks fine and so it should be promoted to the new expected BMP. On the other hand, it may reveal a problem that requires a code fix.
The thing is I don't have any way to get access to these files, other than to ssh into the CI server and manually scp the files over to my own machine for closer inspection. It would be extremely helpful if I could access these files from the Jenkins web interface.
I tried using the build-helper-maven-plugin to attach the relevant files as Maven artifacts, but the problem is that there is no suitable phase in Maven that executes after an integration-test, if any test fails.
What can I do? Can I use the "Copy Artifact" plugin for this?
1) The files in the target folder can be accessed using a link such as /ws/projectname/target/filename...
2) Rather than typing the url each time, the SideBar plugin can be used to add a link to the file to Jenkins' left menu, making it easily accessible.
You need to copy your files into your workspace in a build step and archive them from there - Jenkins lets you specify artifacts only relative to the workspace.
I usually create a directory keyed by the BUILD_ID in the workspace, so that artifacts from different builds do not get mixed up in case I do not clean the workspace and archive from there (specifying ${BUILD_ID}/**/* in the archiving step).
In case your build fails before it can run the copying step and because of it does not do the copy, take a look at this question.

Advice needed with Teamcity artifact paths

For a .NET Developer, the Teamcity artifact paths are not very straightforward.
Per project I do, I have a folder called BuildTools and, within it, folders called Drops and Inputs (drops being the reports and outputs inputs being the config files for various command line apps).
BuildTools/Drops/NDependOut => GenericSolution/Drops/NDepend
Is this correct? BuildTools is from the root of the (custom) checkout dir, and then GenericSolution is from the root of the artifacts path (Called "Artifacts" folder).
The other problem I have is that the NDepend report has a lot of images etc in the same folder as the .html file. How would I upload this? Do I upload the entire folder (in which case, is the syntax above correct?)
In general this is right. TeamCity has an option to zip artifacts before publish. For that use the following syntax
Folder/folder/*/ => destfolder/archive.zip
Another trick is to use TeamCity service message to publish artifacts dynamically from build script.

Resources