Build is never triggered

Hi as the header say I have a problem that automated build is not triggered.
The problem might be outside FinalBuilder but I believe here is the best chance to get some hints.

Last year the company moved everything including buildserver to Google Cloud.
It works fine to login and do a manual build

But also want to automate this.
This is run on Windows Server 2022 DataCenter.
Windows Task Scheduler is triggered to run 5:15 every morning to start this powershell script

$currentTime = Get-Date -Format “yyyy-MM-dd_HH-mm-ss”
$logFilePath = “C:\Attracs\AttracsBuildLog\ScriptLog_$currentTime.log”

Write-Output “Attracs build started at $(Get-Date)” | Out-File -FilePath $logFilePath -Append

Stop-Process -Name “bds” -Force | Out-File -FilePath $logFilePath -Append
Stop-Process -Name “InitializeSystem” -Force | Out-File -FilePath $logFilePath -Append
Stop-Process -Name “TestAttracs” -Force | Out-File -FilePath $logFilePath -Append

Start-Process -FilePath “C:\Program Files (x86)\FinalBuilder 8\FBCMD.EXE” -ArgumentList “-le -co ‘C:\Attracs\AttracsBuild.fbp8’” | Out-File -FilePath $logFilePath -Append
Write-Output “Attracs build stopped at $(Get-Date)” | Out-File -FilePath $logFilePath -Append

So it log time to file, kill some processes if they exists and start FBCMD.exe to build.

Log-file looks like this

Attracs build started at 06/12/2024 05:15:03
Attracs build stopped at 06/12/2024 05:15:04

So it take 1 second to run and nothing is built.
If I start script manually from Powershell prompt it works fine.
If I start script manually from Task Scheduler it ignore FbCMD.exe like 5:15 in the morning

Yesterday I checked “Run with highest priviligies” for the task in Task Scheduler and it works when I start the build from Task Scheduler. So I assumed the problem was solved.

Today I checked FinalBuilder Build History again and no build was done. This was the log so script was triggered.

Attracs build started at 06/13/2024 05:15:05
Attracs build stoped at 06/13/2024 05:15:06

This was logged in Windows Event VIewer

I assume my Windows session is removed 5:15 in the morning so none is logged in.
Task Scheduler task has set “Run whether user is logged in or not”

Any idea what is going on ?

Hi Klund,

One problem here is that you are not actually getting error output from the process to understand what the issue is.

You can redirect both standard and error output from the Stop-Process using the following syntax

Stop-Process -Name "bds" -Force 3>&1 2>&1 | Out-File -FilePath $logFilePath -Append

and you can redirect the output from Start-Process to a file using -RedirectStandardOutput and -RedirectStandardError. e.g.

Start-Process -FilePath "C:\Program Files (x86)\FinalBuilder 8\FBCMD.EXE" -ArgumentList @("-le", "-co", "C:\Attracs\AttracsBuild.fbp8") -NoNewWindow -PassThru -Wait -RedirectStandardOutput "C:\Attracs\AttracsBuildLog\stdout.txt" -RedirectStandardError "C:\Attracs\AttracsBuildLog\p\stderr.txt"

See also: powershell - Capturing standard out and error with Start-Process - Stack Overflow

Have you tried using Continua CI? It is designed to run FinalBuilder projects, it runs as a service and is much easier to use than running PowerShell scripts from the task scheduler.

Hi, thanks for the answer about logging.
I have not tried Continua CI but I know another guy in the team tried it many years ago (more than 10 years). So I am sure a lot is changed now.
But he never managed to integrate it properly in our build so nothing happened.

Hi Klund,

It’s easy to install Continua CI and it’s free until you need to run multiple builds concurrently.

Once installed, you will be guided through setting up a project and configuration. Then, you can quickly get started by adding a FinalBuilder action to call your existing FinalBuilder project.

There’s not really any need for any integration. The FinalBuilder project can generally stay as is - although, depending on your project, it may be advantageous to specify paths used by the project as variables. In the future, you may convert any version control repository actions in FinalBuilder to make use of Continua CI repositories and triggers, but none of this is mandatory.

See this blog post for more some general information on running FinalBuilder projects with Continua CI and let us know if you encounter any problems.