Release Triggered by build does not contain TFS metadata - tfs

Weve been trying to implement Microsoft's Release Management into our CI\CD process between trusted and untrusted servers.
The TFBuild server drops the compiled files onto the drop folder via FTP as post build script, and goes on to trigger the Release process
In the build process i have configured the components to be taken from an UNC: C:\BuildDrop[Build]\Artifacts
The release keeps failing on an error cannot find files under "C:\BuildDrop\\Artifacts...." and u can see the BuildNumber is missing.
after some research in the logs i found out that the metadata of the tfs transfered to the Release server is empty and looks as follows
<Metadata>
<BuildDefinition></BuildDefinition>
<BuildNumber></BuildNumber>
<PackageLocation></PackageLocation>
<ServerName>RMServerName</ServerName>
<ServerDnsName>DNSName</ServerDnsName>
<TeamProject></TeamProject>
<TfsCollection></TfsCollection>
<TfsUrl></TfsUrl>
<TfsUrlWithCollection></TfsUrlWithCollection> </Metadata>
(This was captured using DeploymentAgent.exe debug start)
Note: same user running the DeploymentAgent and the BuildService and has TFSCollection Admin authorization and Administrator on both servers

Related

How do I invoke a publish profile in an automated TFS2017 build?

I have successfully upgraded to VS/TFS 2017, and I am at the point where I want the build to automatically publish a website to a staging location using one of the project's publish profiles. I am impressed with the flexibility in the "Build & Release" section of the TFS Team Project Site, but it's a little overwhelming.
This project has 2 simple publish profiles. Both use the 'FTP publish method' to upload to the Go Daddy hosting provider; one deletes all files before upload, the other only updates files. There are transforms applied for things like connection strings. These publish profiles work properly. I just need them to be added at the end of an automated build.
It would seem it should be simple to say 'use this publish profile', but there are so many options and choices it's not intuitively obvious which to use, and I haven't been able to find a reference on the web that focuses on what I want to do.
If you want to invoke the msbuild command using the publish profile to publish website to FTP location, then it's impossible as FTP publishing is not supported on the command line.
If you insist on invoking the publish profile, then you can invoke msbuild command line with the publish profile used to publish the website to a staging location (eg, local or UNC path), then use FTP upload task step to upload the website from the staging location to the specific FTP location, or using PowerShell script to upload the website.
You can reference this thread:
How can I add FTP website deployment to a VS2015/TFS2013 build process

Release Management in TFS without build automation

We have an automated build process in place which creates the release artifacts for us.
These are copied to an FTP location and post certain processes, the packages are available for deployment to val, customer dev, UAT and prod.
I want to create a Release in TFS where the release should simply use the package from the ftp location instead of triggering a new build.
The process of moving the artifacts to the ftp using a detached build process is legacy and I'm afraid cannot be changed.
I would like to trigger a release ( at the moment I'm testing this using VSTS ) which will use the artifact from an ftp instead of triggering a build.
My build server / process is not in TFS and it's a large application with multiple components.
Trigger a release using the artifacts from an FTP instead of triggering a build is supported. But there's no default steps about download a FTP file for you to use. You need to use command or Powerscript to download.
In the release definition, delete all artifacts under the Artifacts tab. Then it won't download any files from your builds.
Create a bat file or Powershell script file, write the command/script to download those files you want. Here are some methods you could have a look:
How to script FTP upload and download?
How to download files from FTP site in one command line without user interaction (Windows)
https://tecadmin.net/download-upload-files-using-ftp-command-line/
Check the bat/script to TFS and run it in your release definition.

TFS Build Server gives service unavailable (503) message

I recently installed TFS 2015 on a new machine. I want to configure the same machine as our build server but i have massive trouble doing this. I neither can configure the new vNext-system nor can i configure an "old-style" xaml build server. As the build account i want to use the NT AUTHORITY\Network Service. For the xaml configuration i set "Execute service as" to NT AUTHORITY\Network Service and use the same account for the connection to the team foundation server.
But when i add a new controller and want to browse to custom assemblies, i get a "service unavailable" error. So i decided to test without the custom assemblies, added an build agent and created a new build-definition for a simple test project. I added a build to the queue and wait. Nothing happenend (in the build window) until after about 50 seconds an error was shown in the build window: Service Unavailable (Typ VssServiceResponseException).
Same for the new vNext builds. I downloaded the agent.zip from the web-frontend, opened the powershell and started configuring the build-agent. After waiting some minutes, the configuration aborted with.... service unavailable.
So i decided to test something different : instead of using the FQHN, i used localhost and - tataaa - it starts the agent, which is also shown green in the web-frontends agent-tab. So i created a new vNext-Build-Definition and added it to the queue, but it does not start, but shows the message : "waiting for console output from an agent".
So i decided to test it on a different pc : i downloaded the agent to my laptop and installed it, configuring the agent with it's FQHN. Without any problems the agent was started and i was able to start and run a build.
So the question is : Why am i'm not able to configure the build service on the tfs. I guess it has something to do with permissions, but i don't now, what permissions the network service account should have. I also tried it with a local account, but with the same result.
Any hints are very appreciated. Thanks in advance.
BTW: I can ping the FQHN from the command-line.
This is the output, after trying to add a vNext-agent via the powershell.
UPDATE:
I used the the servers IP-address instead of its name and it suddenly worked.
Take XAML build for example, to configure a Team Foundation Build Service, you must be a member of both the Windows Administrators security group on the server on which you are configuring Team Foundation Build Service and the Project Collection Administrators group on TFS.
According to the second paragraph, you can configure build controller and add build agent. Before queuing a build, you need to make sure the build controller and agent are in Ready status, sometimes relevant services are not yet fully available when you newly configure them or restart them.
Also, you may try to remove build service feature, and reconfigure it, to see whether you can solve the issue.

tfspreview, continuous integration, and external folders getting overwritten

The problem stated simply:
using tfspreview.com account linked to Azure website.
using continuous deployment build provided by Azure team.
All works perfectly, when I check in:
code is uploaded to tfs server
Remote Host is used to build code
A drop folder is created with the compiled code
code from drop folder is published to Azure website
Now this is all good, but it always overwrites any external folders (not part of project) that are on the server. I went into the process template and changed 'Clean Workspace' setting to 'None', but that didn't help.
If I build locally and publish using web deploy, things don't get overwritten. What am I missing here? obviously it's something with the build process or drop folders not being aware of the publish settings. Any ideas?

TFS 2010 Build - batch file 'access denied'

Running TFS 2010
I am trying to do a proof of concept, having batch files run as part of the build process. I have an 'invokeProcess' in my build seqeunce which runs a batch file. When I run the build, it 'partially succeeds' and then shows an 'access denied' error on the batch file.
Thoughts? Honestly I'm not even sure how to diagnose what user it is trying to run under.
Is your build server different than your TFS server? In our environment, our build server runs all the windows services that execute the builds. Those builds are executed under the context of the user id that the build service is configured to start with.
To execute a batch file, you not only need to give permissions to the batch file itself, but you also need to grant rights to the cmd.exe file (since this will execute a new command line process) as well as any executables your batch file may call.
Try running procmon (http://technet.microsoft.com/en-us/sysinternals/bb896645) and execute your build again - it will show you exactly what files the system is denying access to.
Have you verified that the service account that is the identity for the build service has access to the batch location? You can find the service account in the TFS Administration Console (available on your TFS Server)

Resources