I am facing an issue when trying to generate build. I have post deploy batch command where I am copying files and folder using xcopy.
This doesn't seem to work.
Is there any solution or work around for this.
On TFS and VSTS you should use the Copy Files task provided.
https://www.visualstudio.com/en-us/docs/build/steps/utility/copy-files
Just drop the task onto the execution stuck and configure it as per the documentation.
You will still not be able to access disc location outside of the agent permission scope.
Related
I have a source code using which I want to test some processes through Jenkins.For that I've installed Jenkins and plugins as well. But I do not have internet access to my machine so I have my source code in a local folder instead of Git.
Please help me to configure Jenkins without git.
Thanks a ton in advance.
in the build steps, you can do something like
cd C:\users\user\Documents\Projects\
// build here
if you're in a different directory, you need to do:
cd D:\Projects
D:
// build here
But deleting the workspace option won't work now. since your artifacts will be stored in the current directory and the workspace is a different directory. you can add an additional step, in this case, to clean up things or you can change the workspace from the advanced option in the general tab.
There is a scenario in which I have to define a build step under Teamcity deploy job configuration. Wherein a compressed file needs to copy from shared drive to udeploy. But firstly I am trying to copy to local drive(WINDOWS OS) for testing.
I am using below command to perform the operation in POWERSHELL, its working fine as expected locally.
Start-BitsTransfer -Source \Shared_Drive_Path\File_Name.zip -Destination Destination_Path
Now, I need to define this command under Teamcity Deploy Job Configuration for its execution.
What configuration i will be requiring to achieve this thing.
Anybody suggest here.
Thanks in advance....... !!
In TeamCity 8.1 I've just pulled down my source code and the first thing I want to do is delete a bunch of subfolders from what I've just retrieved.
I can't use exclusions in the 'Checkout Rules' so I guess I need a separate step to run immediately after retrieving source code.
I guess I need a CommandLine Step? If so I can't seem to find much information about using this to delete a number of sub folders?
Anyone with experience in this area?
You can do it in two ways
use a command line to delete the folders using windows/unix commands. Teamcity publishes a property called teamcity.build.checkoutDir using which you can go the directory and run the necessary delete commands(based on the OS where you are checking out).
A better way of doing this would be to add a target in your build.xml and call the target as the first step of your build
In our team city setup we wanted to delete all existing files in working directory.
We have first build step which cleans up working directory contents using custom command line script.
del /s /q .
for /d %%%y in (.\*) do #rd /s /q "%%%y"
Note: We don't have VCS attached in this build configuration. If you have VCS attached then this solution won't work because TC will first download/copy contents from VCS then this build step will delete all the contents downloaded from VCS.
How to get the latest version of the project file to another folder on every commit?
I'm using VisualSVN server and I think we can do this on post-commit in hooks, but I don't know how. Server is on Windows.
Actually I need to get the latest version of the file to \www folder of IIS7. Simply, get the latest file to another folder.
I've added following code in post-commit hook (for copying latest version files to D:\Destination).
svn export --force file:///D:/Repositories/myproject D:\Destination
exit 2
It works fine for me.
If your trying to export this to a directory of website, need to change the directory permission. Visual SVN is using NETWORK SERVICE.
If you use the same file in more than single folder inside your repository and you Subversion is 1.6 or newer, you can use file-type of svn:externals without binding to revision.
In this case committed to SOURCE file will be updated in Working Copy of TARGET after usual svn up
but I don't know how
You correctly say that you have to do it by post-commit, but if you mean you don't know the process, here is how.
Your post-commit hook is a script which is called after every commit to a project in your SVN repository. There is a file called post-commit in the hooks folder of every repository. Change the file to include the necessary commands* to do the copying for you and make it an executable post-commit.exe.
Afterwards, every time you commit a new revision, that script should handle it for you.
*By necessary commands I mean, either do the copying via the Windows cmd prompt, or call another script to do the job from within post-commit.exe.
Also, even though SVN docs mention that the post-commit hook needs to be either .bat or .exe file, I've had it working only when it's .exe on my machine.
You can convert .bat files into binary .exe using tools available here and here. The second one is much more user-friendly. I hope it helps.
how can I copy the artifacts from Teamcity to another server?
Thanks
The way I have done this, make things a lot easier.. Setup another configuration that pulls in, via artifact dependencies, all the files you need then run a cmd script to xcopy/copy the files to another drive on the network. You can do this using cmd script, vbs, python, shell etc..
Remember, you only need to refer to directories as if they were local as you would have your script in the same working directory
i.e cmd script :: xcopy .\"my build artifact(s)" \path\to\drive\on\my\network\"my build artifacts"
It doesn't get easier than that.
Naturally, if your artifacts are huge, then you may want to consider your more complicated option. However, TeamCity currently have a ticket pending, which you can vote on, that allows you to run multiple runners in one configuration - so you could just add your cmd script to the same configuration to save the copy time; please vote if can spare a minute:
http://youtrack.jetbrains.net/issue/TW-3660
There is a Deployer plugin, that supports deploy by fileshare/SMB, FTP, SSH and other means. The usage is basically the same as the Artifact paths.
We have used just samba, so you must enter:
target Host path: //server/drive/myfolder
Username: mydomain\myusername - in our case we had to write domain
here too
Password: ****
Domain: mydomain
and in path just select the files as in artifacts:
product/* => product.zip
and it will create file //server/drive/myfolder/product.zip
You can do it from your build script or externally.
If you are looking to get artifacts copied from a remote build agent to the primary TeamCity server, you may want to look into configuring Build Artifacts under the General Settings.
According to TeamCity's wiki entry on BuildArtifacts (http://confluence.jetbrains.com/display/TCD7/Build+Artifact) "Upon build finish, TeamCity searches for artifacts in the build's checkout directory according to the specified artifact patterns. Matching files are then uploaded ("published") to the TeamCity server, where they become available for download through the web UI or can be used in other builds using artifact dependencies."