Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Does promote copy variables as well as files? #2435

raimainc ·
If you specify variables in the promote, do those variables get copied to the configuration being promoted to? If not, what would be the correct way to update a variable in the target configuration for the promote?
  • replies 10
  • views 3294
  • stars 0
robinshen ADMIN ·
No variables are never copied, for a particular variable, if you want target build has the same variable value as original build, define the variable in promotion definition:
var name: <name of the variable>
var value: ${build.getVarValue("<name of the variable>")}
reinhold.fuereder ·
Hi Robin,

is this (variables from promotion source build are NOT copied automatically to promotion destination build) still the case?

Somehow it looks like in our experiment (using QB version 5.0.22) all variables (maybe that are used in the promotion source build?) are automatically also copied to the promotion destination build.

Thanks,
Reinhold
robinshen ADMIN ·
Yes that is true. In QB5, when access a certain variable, it searches in below order:
1. variables defined in promotion setting.
2. variables defined in target configuration hierarchy.
3. variables used in source build.
reinhold.fuereder ·
Robin, thanks for your fast and enlightening reply: I must admit that this actually seems to be exactly what appears to be right (in the sense of usefulness and convenience), although if you had asked me before, I would have said item 3 is not allowed <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) --> => excellent work by you and your team!

Would you mind updating this in the documentation, or did I just overlook it there?

Thanks, Reinhold
robinshen ADMIN ·
Hi Reinhold,
This is mentioned in variables description when you edit a promotion.
reinhold.fuereder ·
Hi Robin,

sorry for my late response, but while I still was a little bit confused (why => see below), I was on the other hand a little bit happy/lucky, because this (automatically looking for variables in source build) also helped me; although the documentation at http://wiki.pmease.com/display/QB51/Set ... +Promotion in section "Control promotion process with variables" IMHO still says something different (i.e. no auto-availability/promotion of variables).

Anyway.

Now that I continued with our build pipeline this aforementioned confusion re-happened:
[list]
In our case we have some rather generic steps that are configured by means of variables (to avoid/reduce duplications and thus a maintenance nightmare) and these step configuration variables are also automatically available/promoted in any (!?) subsequent stage.[/*:m]
one general checkbox (enabled by default for old backwards compatible behaviour) for "auto-availability/promotion of all variables of source build in destination build"[/*:m]
[*] and in the variables section -- for the sake of convenience -- a dedicated checkbox per variable that allows to keep all fields except name empty (i.e. prompt, value, description) that says "auto-availability/promotion of this variable of source build in destination build"[/*:m][/list:u][/*:m][/list:u][/*:m][/list:u]

What do you think of this approach?

Thanks,
Reinhold

P.S.: Now (a few minutes after this post) I found "Use value stored in source build during promotion" -- this would replace the dedicated convenience checkbox in item #2 of the aforementioned approach. But of course I still think this is automatically the case for all variables (not defined in the promotion variables section), which can be very dangerous...
robinshen ADMIN ·
The auto-available variables from source build is taking the lowest priority, so it should not be too dangerous. For instance, if some step of the source configuration and destination configuration is differentiated via configration variables, it will not be affected by auto-available variables from source build as variables defined in configurations will be used instead. Only those explicitly declared variables in promotion definition overrides configuration variables.
reinhold.fuereder ·
I do understand that, however there is one unfortunate/dangerous situation possible: if I just forget to configure the variable in any later stage. (Then it will automatically/"silently" be using the value from the last of any previous stages that actually had it set...)
perrog ·
A follow up question on the scope order.
[quote="robinshen"]Yes that is true. In QB5, when access a certain variable, it searches in below order:
1. variables defined in promotion setting.
2. variables defined in target configuration hierarchy.
3. variables used in source build.[/quote]
Does it matter if my script call vars.get("") or build.getVar("") in destination build?
Do they always contain the same set of variable values (e.g. vars.getAll() <=> build.getVariables())?
robinshen ADMIN ·
Always use vars.get(...) instead of build.getVar(...) as vars.get(...) also consider the case of chained variables and variable values stored in steps. However build.getVariables() returns the same set of variables as vars.getAll().