When I build my project, I can get ${BuildNumber} variable.
BuildNumber can be customized by "UpdateBuildNumber" activity. In this activity we can use ${BuildId} to formate ${BuildNumber}.
But how to get separately ${BuildId} variable?
If you're looking for the BuildNumber:
Use the BuildDetail's BuildNumber property when setting the BuildNumberFormat property of the UpdateBuildNumber build step.
In the example build XAML below, the BuildNumberFormat property is set to:
newBuildString + BuildDetail.BuildNumber
newBuildString is a variable, but could also be a string:
"v1.2.0." + BuildDetail.BuildNumber
If you're looking for the BuildID:
The TFS internal BuildID can be extracted from the URI for the build, as accessed from the IBuildDetail object (see above).
This can be accessed using the following code:
LinkingUtilities.DecodeUri(BuildDetail.Uri.ToString()).ToolSpecificId;
See: https://social.msdn.microsoft.com/Forums/vstudio/en-US/ab8140a2-a236-40d0-b146-dd8f6f4eb4ce/getting-buildid-value-in-a-tfs-2010-build-workflow-activity?forum=tfsbuild
Related
My issue resides on the fact that when I invoke via Jinja the variable {{ flags.WHICH}} it returns no output.
I am trying to use this variable to get what type of command the DBT is running at the moment, either a run, a test, generate, etc.
I am using the version dbt 0.18.1 with the adapter SPARK
flags.WHICH was not introduced until dbt 1.0. You'll have to upgrade to get that feature. Here is the source for the flags module, if you're interested about the flags available in your version.
Note that in jinja, referencing an undefined variable simply templates to the empty string, and does not raise an exception.
I have a groovy script step in my process, this script sets a output property. I want to use this property value to set a property on a subsequent step.
Or
Simply use this property value in another groovy script step in my process.
The documentation says i need to use ${p:stepName/propName}. But how do I use it. can anyone give me an example. Assume that the process is the following
1) groovy step with name 'Run Groovy Step', this set the value of property 'CityName' to 'London'.
2) groovy step that wants to use the value of 'CityName'.
How do i use ${p:stepName/propName}?
is it ${p:Run Groovy Step/CityName}?
Yes, that's basically it. You set the output property either with Groovy or in the post-processing script of a step. Then you access it with ${p:stepName/propName} or with properties.get(stepName/propName). Your code ${p:Run Groovy Step/CityName} should work.
For an example:
http://ibm.com/support/knowledgecenter/en/SS4GSP_6.2.2/com.ibm.udeploy.doc/topics/output_properties.html
I am essentially asking for an update to date answer to the already answered question: Can I pass a parameter to a F# FAKE build script?
Here is build.fsx
let revisionNumber = getBuildParamOrDefault "rev" "123"
Target "Log" (fun _ ->
trace ("Revision Number: " + revisionNumber)
)
RunTargetOrDefault "Log"
Output running Fake.exe .\build.fsx:
Perfect!
Output running Fake.exe .\build.fsx rev=456 (as suggested by this answer: https://stackoverflow.com/a/26597179/2382536):
Starts with
But at the bottom gives the correct result:
What format do I need to pass the parameters in to get rid of the warning message?
Passing parameters is done using the --envvar parameter. Until recently you can just add parameters in a way you did after the build target but not anymore. I believe this was changed in order not to confuse build parameters with (optional) build target name.
So, try this:
fake build.fsx Push --envvar rev 456
I just want to share the link to the official documentation:
TLDR:
You can either use
--envvar [-ev] <name:string> <value:string>
to set a variable to a custom value, or
--envflag [-ef] <name:string>
to set a variable to true, or
--fsiargs --debug+ buildscript.fsx someArg1 anotherArg2
to pass all arguments (including build script name, importent!) direcly to fsi.exe
I would like to control 'global' config in Gradle build scripts using external property files on each build machine (dev, ci, uat,...) and specify the filename with a command line argument.
e.g. gradle -DbuildProperties=/example/config/build.properties
I specifically don't want to use gradle.properties as we have existing projects that already use this approach and (for example) we want to be able to amend database urls and jdbc drivers without having to change every project.
So far have tried:-
Properties props = new Properties()
props.load(new FileInputStream("$filename"))
project.setProperty('props', props)
which works but has a deprecated warning, but I can't figure out how to avoid this.
Have also tried using groovy style config files with ConfigSlurper:-
environments {
dev {
db.security {
driver=net.sourceforge.jtds.jdbc.Driver
url=jdbc:someserver://somehost:1234/some_db
username=userId
password=secret
}
}
}
but the colons and forward slashes are causing exceptions and we don't want to have to mess up config with escape characters.
There must be a non-deprecated way to do this - can anyone suggest the 'right' way to do it?
Thanks
You can get rid of the deprecated warning quite easily. The message you got probably looks something like this:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "props" on "root project 'private'", value: "true".
It can be fixed by replacing:
project.setProperty('props', props)
with
project.ext.props = props
Just to supplement the response given by #Steinar:
it's still possible to use next syntax:
project.ext.set('prop_name', prop_value)
in case you have several properties from file:
props.each({ project.ext.set(it.key, it.value)} )
I've defined an MSBuild activity in a TFS Workflow template, but currently I have to hard code the 'property' command line arguments directly into the template.
I'd like to be able to specify the arguments in the build definition, via the advanced setting, 'MSBuild Arguments'
I can see that I may have to build up the command line with string replace/concat, as mentioned here, but I can't see what I need to put, maybe something like this:
This is what the default MsBuild task uses:
String.Format("/p:SkipInvalidConfigurations=true {0}", MSBuildArguments)
You can change the MSBuildArguments variable in the build process template in multiple steps. For example, I added a Run Architecture Validation property to the process template and then edited the workflow to simply append /ValidateArchitecture=true to the MSBuildArguments before they're being passed to the MsBuild activity.
<If Condition="[PerformArchitectureValidation]" DisplayName="Configure Architecture Validation MSBuild Arguments">
<If.Then>
<Assign>
<Assign.To>
<OutArgument x:TypeArguments="x:String">[MSBuildArguments]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[MSBuildArguments + " /p:ValidateArchitecture=true"]</InArgument>
</Assign.Value>
</Assign>
</If.Then>
</If>
The PerformArchitectureValidation variable is defined as a Property on the Build Process Template level of type Boolean.
Update: Wrote a blogpost that explains this with steps and screenshots