TeamCity migration without build history - teamcity

We use TeamCity 10.0.4 (build 42538) and want to migrate to the latest version (2022.04) with all our build configurations but without the build history. We saw here https://www.jetbrains.com/help/teamcity/how-to.html#Copy+Manually that:
If you want to do a quick check and do not need to preserve the build
history on the new server, you can skip Step 6 (cloning database) and
all the optional items of Step 4.
Unfortunately by doing this manual copy we were not able to run the new instance without cloning the database, as we got the error on the image below.
We then did a "Restore from backup" (from the image below) by doing a "TeamCity Backup" (Administration > Backup > Run Backup) of the server settings, projects and builds configurations, with no more success.
Do you know a way to migrate to a newer TeamCity version by keeping all the build configurations and removing the entire build history ?

You could try to export/import current projects:
Export to zip archive via Actions button or manually backup teamcity_data_dir/config/projects folder
Install fresh new TeamCity server
Copy your backup to teamcity_data_dir/config/projects

Related

Jenkins execute a job from work space instead of SVN path

I want to trigger a Jenkins job for a maven(v3.5.3) project from my local work space folder location instead of configuring SVN Repository URL in the Source code management section. Is there a way to achieve this?. I need to test with code modifications in the project and not wanting to commit the changes, that is the purpose.
I am using Jenkins (v2.161) and it is installed in another machine.
Thanks in Advance.
Although it might look like a sort of tinkering, the source code can be pulled to the Jenknins' host from your local machine, provided that they are properly configured to communicate via ssh.
In the project build configuration on Jenkins' host:
Do not use "Source Code Management" (choose "None").
Check "Delete workspace before build starts", to avoid conflicts with previous changes.
As the very first build step, add "Execute shell" and write a few commands that pull the data, for example:
scp myusername#myhost:/path/to/myworkspace/myproject/src .
scp myusername#myhost:/path/to/myworkspace/myproject/pom.xml .
# etc for all the files/dirs you need to build the project
Then continue with the build steps that were already used for building the project from SCM.

Deploying to Octopus from Teamcity with .Net Core not creating .zip

I am doing the following steps:
dotnet restore
dotnet publish
octopusDeploy: Push packages
The second step creates a 'published-app' folder and the third step is meant to take that and create a .zip file and send it to the Octopus server.
The third step is connecting to the Octopus server but gives the error:
Running command: octo.exe push --server http://server.com/ --apikey SECRET
Pushing packages to Octopus server
Please specify a package to push
I am following this https://stackoverflow.com/a/38927027 so my third step has:
%teamcity.build.workingDir%/published-app/**/* => App.zip
Any ideas why the zip file is not being created?
Not sure if you ever got this working for yourself, however just in case it helps anyone we recently came across the same issue deploying an AspNetCore 2.0 web application running on net471 being built by TeamCity 2017.1.4 (build 47070).
After some tinkering I noticed that the "OctopusDeploy: Create and Push Packages" build step ran at our git checkout root directory, so I ending up having to use the following values for the "Package path patterns"
%ProjectDirectory%/published-app/**/* => %ProjectName%.%GitVersion.NuGetVersion%.zip
NB: %ProjectDirectory%, %ProjectName% and %GitVersion.NuGetVersion% are build parameters we have manually defined elsewhere in the build process that TeamCity can replace. %ProjectDirectory% is simply the application's source directory relative to the root of the git checkout i.e. WebApplication1 so the full path would be <full checkout path>/WebApplication1
Another gotcha that we experienced was that at the time of writing the combination of TeamCity and octo.exe (from Octopus.TeamCity v4.15.10) didn't like creating nupkg files, so make sure you try to produce a ".zip" file. In the error instances we would receive the following error:
Error from Octo.exe: Cannot run program "C:\BuildAgent\temp\buildTmp\octo-temp\3.0\octo.exe" (in directory "C:\BuildAgent\work\4e62985fa616fa1f"): CreateProcess error=206, The filename or extension is too long

Restore TeamCity deleted build configuration

I'm trying to restore accidentally deleted build configuration on TeamCity 9.X following this article "https://confluence.jetbrains.com/display/TCD9/How+To...#HowTo...-RestoreJustDeletedProject"
However, I cannot find _trash folder under /config
I'm running TC on Windows and using internal DB.
What am I doing wrong?

Dependencies not getting updated in TFS Build Server

I have created a Smart Device CAB Deployment Project and contains dependencies eg: Test.dll.
Where Test is a seperate class library. I have created a build definition for this solution(contains Test Proj + CAB deployment Proj). When i trigger queue new build for this definition Test.dll is not getting updated in CAB deployment project in Build Agent folder of TFS Server.
PLease let me know how can i reload this dependencies on checking in / queuing new build.
Thanks in advance
Check your Workspace option on Process tab. It should be All or Outputs if you wish to have always fresh version. None option is for incremental builds. If your project is really small "All" is the best option for you.
All - erase entire workspace and download and build everything again
Outputs - like All but only output bin folders are erased and new
version is downloaded (get latest version) from source control.
(incremental get) (like Rebuild (cleen + build) in your solution)
None - sources are build incrementally. Like Get latest version +
Build command in VS

Change Jenkins job workspace

What I have done :
I have Jenkins set up on my Ubuntu in :
/var/lib/jenkins/
I have a job, that runs every 45 minutes that does a hg pull and hg update --clean default
from my bitbucket repository.So this is running fine.I have a folder
/var/lib/jenkins/jobs/Code Deployement
which contains the latest updated code from my repository.
Problem :
However, I want to access my updated code from
/var/www/html/[project-name]
Query :
Is there anyway i can make jenkins job update this folder instead of the /var/lib/jenkins/Code Deployment folder ? I certainly dont want to make /var/www/html/[project-name] as my jenkins home folder.
How can I achieve what I described above.Will I have to copy the folder from the jobs folder to my desired location after every time the job runs ? Please help me out with the solution,I'am a beginner with automated deployment using Jenkins.
Thank you.
Under "Advanced" you can explicitly choose a working directory for the projects without changing the Jenkins home directory. Check the "Use custom workspace" box and set the directory that Jenkins will pull the code to and build in.
In our setup we wait for the build process to complete in the working directory and add a build step for Jenkins to copy (most) of the files out to the directory that serves up the website. We had issues with file locking preventing the build process if someone (e.g. the testers) were using the site.
One simple way to do it is to create a symlink under /var/www/html/ that points to your code directory, e.g.:
sudo ln -s /var/lib/jenkins/jobs/"Code Deployement" /var/www/html/[project-name]

Resources