Replace Continua CI's versioning with value produced (by FinalBuilder 8 or in general) during the build?

Hi,

We are in the process of migrating from FBServer+FB7 to CCI+FB8
FB8 is still our main build runner, our FB8 (converted from 7) projects are rather complex and take care of 100% of the build and deploy processes, including versioning.

Currently when I test builds via CCI+FB8 it seems CCI versioning is mandatory (either per project or per configuration).
Alas these version numbers are meaningless to us, our REAL version numbers are produced during the FB8 project run.
Can versioning be disabled completely or setup to be overridden by values produced by FB8 during the build?

Thanks!

In Finalbuilder 8 there are some Continua CI actions - one of which is Set Build Version - this outputs a formatted message that Continua CI understands and will update the build version in Continua CI.

1 Like

Thank you Vincent!
The only problem we have with this is - when running the build always still starts with version 1.0.0.XY Which is taken from Continua CIā€™s Internal versioning mechanism, and only later some time during the FB8 project run time - this gets updated to the correct version information provided by the FinalBuilder action.
Since this can be some what confusing - is there a way to completely disable Continua CIā€™s versioning for specific projects or configurations and only display it if updated externally (from FB8 in our case)?

We ran into the same problem. We changed our ā€œVersion Format Stringā€ under a Configuration | 1. Details to ā€œStarting $Build.BuildNumber$ā€

This removed the confusion.

1 Like

Robertā€™s answer is what I would suggest.

There needs to be some text to display for the build version, but this can be anything.

You can set the Version Format String to ā€œ-ā€ to be minimal, but itā€™s better to set it to something unique as suggested by @rlove.

The initial version (before the Version Format String gets set) is the same as ā€˜# $Build.BuildNumber$ā€™. Another option would be to use the time e.g. ā€˜Created $Server.Now.ToShortTimeString()$ā€™

If I use ā€œStarting buildā€¦ā€ as our ā€œVersion Format Stringā€ -
It works great for good builds where the underlying FinalBuilder 8 project uses the ā€œContinua CI - Set Build Versionā€ to set the correct version on Continua CI.
(It updates from ā€œStarting Buildā€¦ā€ to whatever FinalBuilder 8 sets the version to)

But if the FinalBuilder 8 project fails BEFORE reaching that action -
The text remains ā€œStarting buildā€¦ā€ and only changes to show a red background color.

I have resolved this by adding another stage that triggers only if
$Stage.IsSuccessful$ does not equal ā€œTrueā€
And adding ā€œSet Build Versionā€ action to that stage that updates the Version format string to ā€œBuild Failed!ā€
That works, but this text (ā€œBuild Failed!ā€) shows in green because the the build actually completed successfully (the main stage that is running finalbuilder 8 - failed, but the ā€œOnFailureā€ stage that came after it - obviously completed succefully)

I did not see a ā€œSet Build Statusā€ or other equivalent actions (ā€œFail Buildā€ ?) in Continua CI:
Could you guys possibly allow the ā€œSet Build Versionā€ Action in Continua CI to have a ā€œBuild statusā€ option that would indicate the build status, and color the ā€œVersionā€ in all screens accordingly?
If not - any other solution would be appreciated!

I tried to solve this by adding an action that will 100% fail in the ā€œOnFailureā€ stage.
This way the ā€œOnFailureā€ stage will always finish with an actual failure and the version color will be red.
I used a ā€œ7-Zip Extractā€ action that is set to extract a file that does not exist.
Alas this results with good builds ā€œVersionā€ being colored in red since the ā€œOnFailureā€ - always failsā€¦ and the build status is reflecting the final result of running all stages and not just the ā€œFB8ā€ stage.

Bottom line is: I can use my mentioned solutions above and get ā€œBuild Failedā€ text on failed builds and a real Version number on good builds - but the color indicating build status is wrong this way.

Hi @ktopaz,

You can fail your ā€œOnFailureā€ stage using a Stop action set to ā€˜Stop stage and build as failureā€™:

Surely with your $Stage.IsSuccessful$ does not equal ā€œTrueā€ condition the ā€œOnFailureā€ stage only runs when the Finalbuilder action fails, so I donā€™t see how the ā€œgood buildā€ would be coloured red?

Instead of adding a new ā€˜OnFailureā€™ stage, you can wrap the FinalBuilder action with Try and Catch actions. Add your Set Build Version and Stop Action under the Catch action. e.g.

image

This will have the advantage that the actual stage that failed will show as failed.

Note that could done similarly using the Try, Catch and Stop Build actions in FinalBuilder.

When using the extra ā€œOnFailureā€ stage and having the first stage successful - the entire build evaluates as not successful because the gate to the next step is failing its condition
ā€œ$Stage.IsSuccessful$ does not equal ā€œTrueā€ā€ - this evaluates to false and thus:

ā€œThe following Stage Gate Condition failed:
The expression [ā€˜$Stage.IsSuccessful$ā€™ does not equal ā€˜Trueā€™] evaluated to False. ā€˜Trueā€™ equals ā€˜Trueā€™.ā€
Due to this message - The ā€œOnFailiureā€ Stage Gate Condition failure to match the previous stage `$Stage.IsSuccessful$ to True - The entire build seems to be marked as failed.

But regardless of that, I am trying to use try-catch instead of a separate stage as you suggested because this idea does seems more logical to me - but thereā€™s something strange going on:

Under ā€œcatchā€ I set the build version format string to ā€œBuild Failed!ā€ and set a ā€œFinalBuilderFailedā€ variable to ā€œFailedā€ and just below that (outside the ā€œCatchā€ clause) -
I have an if condition to check if indeed ā€œFinalBuilderFailedā€ variable evaluates to ā€œFailedā€ - if it does - then it runs a ā€œStopā€ action that should mark the stage and build as a failure.

What actually happens is:
FB8 Run fails (I cause this deliberately by passing a non-existing git branch to FB8 to deploy from)
The ā€œBuild Versionā€ is updated to ā€œBuild Failed!ā€ (as expected, 1st nested command under ā€œCatchā€)
ā€œFinalBuilderFailedā€ variable is set to ā€œFailedā€ (as expected, 2nd nested command under ā€œCatchā€)
If clause checks if ā€œFailedā€ is listed under ā€œFinalBuilderFailedā€ variable and if so calls ā€œStopā€ action which is set to ā€œStage and build as failureā€

BUT the ā€œBuild Versionā€ (the same one that says ā€œBuild Failedā€ is in greenā€¦ because somehow the build evaluates as successful even though the ā€œStopā€ action should have marked both stage+build as failures.

attaching screenshots of the stage setup and of a failed build to illustrate:

Hi @ktopaz,

Sorry, didnā€™t I realise when you wrote

that you were talking about a gate condition. If the gate conditions are false then the build fails, so I can see why this would not work in your scenario.

I suspect that you stage gate no longer includes the default condition: "$Stage.IsSuccessful$" Equals "True". If this condition is removed, I see the same behaviour as you.

However the Stop action set is to ā€œStage and build as failureā€ so really the gate condition should not matter, the build should fail before evaluating the gate conditions.

Thank you for reporting this - it appears to be a bug, and we are now investigating a fix.

1 Like

Thank you, That was indeed my scenario - after removing the ā€œOnFailureā€ stage earlier Iā€™ve removed all stage conditions
I only have 1 stage at this point (to call FB8) so I didnā€™t think it would matter but I see now that this has further implications, anyway - nice catch! Iā€™ve added this condition again and now it works as expected.
Looking forward to seeing your solution/fix in regards to the ā€œStopā€ action in an up & coming release!

Hi @ktopaz,

Version 1.9.1.471 includes a fix for the Stop action

1 Like