You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fake writes its version string to stderr when -v is given #2066
It feels like the ouput of Fake build (probably the line with the version) is detected as a Build error
At the very begining of the the build (even before the restore step) the build goes from Green to red
Expected behavior
The build should not detect "Some" lines as error when it feels like it is just "Verbosity"
Actual behavior
As it is delicate for me to output code from the company here is what the build log looks like
Known workarounds
Manually open the log for each TeamCity build ...
Related information
Operating system - Win2016
The code targets, for the CLI, that's a good question, i use fake-cli as a dotnet-tool
Severity : Critical (cannot dissociate Success or failure)
Version of FAKE 5.4.x
the script is ran using a Powershell PS1 :
function Invoke-FakeBuild([string]$TargetName) {
$fakeBuildArgs = "./$($fakeCli) -v run $($BuildScript) --no-cache --parallel 8 --target $($TargetName)"
if ($SkipUnitTests -or $SkipIntegrationTests) {
$fakeBuildArgs += " --"
# Only set switch this for testing Pack/Push for the Fake script
if ($SkipUnitTests) {
$fakeBuildArgs += " --skip-unit-tests"
}
# Only set switch this for testing Pack/Push for the Fake script
if ($SkipIntegrationTests) {
$fakeBuildArgs += " --skip-integration-tests"
}
}
Write-Host "Execution expression : '$($fakeBuildArgs)'"
Invoke-Expression $fakeBuildArgs
}
Invoke-FakeBuild -TargetName $TargetName
As you can see i do not read the exit code of the Fake Build in order to let the powershell return the good exit good.
So far it ALWAYS return 0 (so in this scenario it should not affect the build result)
here is a little update to the script fake boostrap :
functionInvoke-FakeBuild([string]$TargetName) {
$fakeBuildArgs="./$($fakeCli)"$runArgs=" run $($BuildScript) --no-cache --parallel 8 --target $($TargetName)"if ($FakeVerbose) {
# THIS IS THE ORIGIN OF THE ERROR$fakeBuildArgs+=" -v"# THIS IS THE ORIGIN OF THE ERROR
}
$fakeBuildArgs+=$runArgsWrite-Host"Execution expression : '$($fakeBuildArgs)'"Invoke-Expression"$($fakeBuildArgs) 2>error.log"
}
Invoke-FakeBuild-TargetName $TargetName
changed the title [-]TeamCity Build Running fake detect output as error[/-][+]Fake writes its version string to stderr when -v is given[/+]on Aug 15, 2018
I updated the description. I'm not exactly sure if this is actually a bug or by design. I guess I'll have to think about it and compare to other tools. But I think other tools do the same.
In fact: We might even decide to write a lot more into stderr in order to have deterministic output on stdout with and without -v flag (ie only stderr would be different)
On the other hand we don't really have deterministic output anyway. If you want that you would use -s (silent). Anyway: Workaround is to disable "fail on standard error" in TeamCity or do not use -v.
I'm also fine removing the -v, i added it so we would have maximum info while building, but i it might be not that important on the CI
Should i run my CI/CD with -v on all run ? or should it be really on few occasion
I feel like i'm going to remove the -v if you confirm it will help us fix build issue on really few occasion
side note, if you'd like deterministic build output you can also format stdout kinda like logs framwork does when outputing to the console
Yes please remove -v. Verbose is basically a fallback if you want to debug fake itself and need to know exactly what's going on (there is even -vv if -v is not enough). As long as you don't have any issues going without -v is the suggested way to use fake.
In fact, because -v is so verbose we have a more lightweight way to debug issues without using -v which is to set the environment variable FAKE_DETAILED_ERRORS to true. This will only add more details when an error happens and be "normal" otherwise.
i'll keep my powershell switch but defaulted to false so that the CI won't use -v by default
I let you decide what to do with this issue, depending if you still need to keep it open for the stdout/err feature, or just close it. Now i understand a bit more the behavior ;)
Yes, I think I'll not consider this a bug but improve the behavior by changing the message we print to stderr a bit.
For example:
FAKE 5 - F# Make (version) running in verbose mode (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066)
This has the "advantage" that you can "test" what your CI is doing when something is written to standard error. This seems reasonable for verbose mode.
Activity
kblohm commentedon Aug 15, 2018
Have you tried adding TeamCity as a BuildServer? As in
I am using FAKE with teamcity and it is working just fine for me.
tebeco commentedon Aug 15, 2018
here is a little update to the script fake boostrap :
tebeco commentedon Aug 15, 2018
@kblohm at the begining of the script i guess ?
tebeco commentedon Aug 15, 2018
@kblohm
can you try with
fake -v run?tebeco commentedon Aug 15, 2018
@kblohm, i just rollbacked this
as it completly destroy the Teamcity logs in the UI, tons of line ending does not render, it was way worse ;)
using teamcity 10.0.x
[-]TeamCity Build Running fake detect output as error[/-][+]Fake writes its version string to stderr when -v is given[/+]matthid commentedon Aug 15, 2018
I updated the description. I'm not exactly sure if this is actually a bug or by design. I guess I'll have to think about it and compare to other tools. But I think other tools do the same.
In fact: We might even decide to write a lot more into
stderrin order to have deterministic output onstdoutwith and without-vflag (ie onlystderrwould be different)On the other hand we don't really have deterministic output anyway. If you want that you would use
-s(silent). Anyway: Workaround is to disable "fail on standard error" in TeamCity or do not use-v.matthid commentedon Aug 15, 2018
One other thing we write to stderr (which would make your build red) is warnings (https://github.com/fsharp/FAKE/blob/release/next/src/app/Fake.netcore/Program.fs#L160). But that might be exactly what you want?
matthid commentedon Aug 15, 2018
Ok I'm fine with changing this particular behavior...
tebeco commentedon Aug 15, 2018
thx for the title, that's a good idea
I'm also fine removing the
-v, i added it so we would have maximum info while building, but i it might be not that important on the CIShould i run my CI/CD with
-von all run ? or should it be really on few occasionI feel like i'm going to remove the
-vif you confirm it will help us fix build issue on really few occasionside note, if you'd like deterministic build output you can also format stdout kinda like logs framwork does when outputing to the console
matthid commentedon Aug 15, 2018
Yes please remove
-v. Verbose is basically a fallback if you want to debug fake itself and need to know exactly what's going on (there is even-vvif-vis not enough). As long as you don't have any issues going without-vis the suggested way to use fake.In fact, because
-vis so verbose we have a more lightweight way to debug issues without using-vwhich is to set the environment variableFAKE_DETAILED_ERRORStotrue. This will only add more details when an error happens and be "normal" otherwise.tebeco commentedon Aug 15, 2018
ok, thx for the answer
i'll keep my powershell switch but defaulted to false so that the CI won't use
-vby defaultI let you decide what to do with this issue, depending if you still need to keep it open for the stdout/err feature, or just close it. Now i understand a bit more the behavior ;)
Thx for all the details
matthid commentedon Aug 15, 2018
Yes, I think I'll not consider this a bug but improve the behavior by changing the message we print to stderr a bit.
For example:
FAKE 5 - F# Make (version) running in verbose mode (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066)This has the "advantage" that you can "test" what your CI is doing when something is written to standard error. This seems reasonable for verbose mode.
tebeco commentedon Aug 15, 2018
thx for all the precision