I am creating a deployment in Bamboo. I have some variables set up under the deployment plan. How can I access these from a Gradle script? There is an arguments input (that I guess I would use something like variable=${bamboo.variable} in there, but I cant work out how to get them to go through to the script (at the moment just doing something like prinln varible to get them out). How can I do this?
As far as I know, Bamboo exports all it's variable into the build environment. In that case, you can get any variable within the script as follows:
System.getenv('bamboo.variable')
Alternatively, you may pass it into the build as build script parameter, like so:
-Pvariable=${bamboo.variable}
and then you can get it within a script as a project property:
println variable
Related
I know how to export/share an artifact from one stage/job to another. In my job configuration, I can say "place artifact 'My artifact' in into destination directory 'foo'" That works and all, but in my job, I'm calling a script where I want to pass that artifact as a parameter. How can I tell what that artifact's name is? I can't pass foo/* as an argument to the task Script as the * is literally passed instead of shell expanded, even if I mark the Interpreter as Shell.
It seems that there should be some sort of ${bamboo.artifact} type of variable that I could pass, but I was unable to locate something. I know the Bamboo name of the artifact, so it seems like there should be a way to know exactly what the variable name is without having to resort to shell wildcarding hacks.
I looked at https://confluence.atlassian.com/bamboo/sharing-artifacts-359400060.html#Sharingartifacts-Sharingartifactsbetweenjobs and https://confluence.atlassian.com/bamboo0610/bamboo-variables-980469487.html
I'm looking at VSTS Build with the eyes of a Teamcity user. I'd like to set up multiple builds that each have the same set of parameters for MSBuild to use. For example, I'd like all my builds to share the CreateHardLinksForCopyFilesToOutputDirectoryIfPossible parameter.
I know I can manually write out /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true in each build configuration I set up, but I'd prefer to set this once using the variable system. However, when I set my variables using the variable editor, the VSTS agent converts variable names to upper case (as well as converting "." to "_" and other transforms), which means msbuild doesn't look at them (it was expecting the correct PascalCased version). I have verified this by echo-ing out all current environment variables, during build. I can't see any documentation on why this happens.
Is there a pattern to pass MSBuild parameters in via the variable system?
For VSTS variable name, it’s case-insensitive. You just need to focus on the variable’s value.
Such as if you have the variable tHisIsMixEdCase with the value /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true.
Then no matter to use $(THISISMIXEDCASE) or $(tHisIsMixEdCase) in MSBuild arguments option, both of them work same as using /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true directly.
Is it possible to use a variable as build trigger? I've tried and the build doesn't get triggered. If I remove the variable and insert a value, the build gets triggered as expected.
Aren't variables allowed here? $(Mapping.ServerPath) is set to MyRepo/Branches/MyBranch. $/MyRepo/Branches/MyBranch triggers the build correctly.
No. And why should they?
The specified path results in a poll action being performed on the static path.
You can use wildcards if needed.
The build should trigger on a change, hence CI trigger.
Making the path a variable, when would you provide it?
If it's just keeping a static value elsewhere, why not fill it in?
If you want to provide the path when calling the build.
Then you don't intend to use the CI option as intended?
No, it is not supported.
There is a user voice that you can follow: Allow Variables in Repository, variables and triggers Tab.
We have a microservice architecture with dozens of builds, it makes sense to be able to use a variable that we can update when we start our next iteration. With our branching strategy we have a new branch for each sprint and for each release. Changing the CI trigger in every build every couple weeks is inefficient.
We are using on premise TFS2018 and from everything I've seen this is not supported.
I am using the Intellij 11.1.5. We are a large team, and have a pretty complex project setup. so we've made a template and when someone needs a new project set up, we just clone it and she is pretty much ready to go. One other thing i would like to automate is the creation of run configurations. One such configuration starts a custom bat file that requires a parameter representing a path that is user specific. I wanted to know if can store that value as a path variable specific to each project. Maybe somewhere in the .idea folder in my project. I know that Intellij stores it in its .IntelliJIdea11\config\options\path.macros.xml file, but is there a way to tweak that?
Any other idea that would allow me to locally store a parameter passed to the run config script would be usefull.
Thanks
I'm afraid you can't do it in IDEA, but you can use some environment variable directly in the .bat file instead of using the parameter (or rewrite the batch script to detect this value automatically, if possible). Instruct your users to define this environment variable.
IDEA Path variables are global and cannot be made project specific.
is there any plug-in or other possibility to set an environment variable in CC.NET 1.4.2 to some generated value. I would like to pass to MSBuild some random value (can be a time stamp where to put some build reports). Afterwords all the generated report files from the randomly named dir will be merged to cc.net report.
The problem here is that I can't use the CCNetBuildDate + CCNetBuildTime environment variables, due to the format of CCNetBuildTime (HH:mm:ss), because : is not a valid character for directory name. I could use them if CC.NET supports ':' replacement by some other char (e.g. '-').
I can use MSBuild community task to create the output directory with the help of <Time>-task, the problem is that I don't know how to return to CCNet in which random dir the reports were produced.
I can't use the labeller either, because we have rewritten the labeller and it always returns the dummy label (I know that is very bad and changes ccnet logic, but currently I have no choice).
I can write a plug-in, but I would like to use as much default technologies as possible.
Many thanks,
Ovanes
Can't you just produce the report files in the normal project working directory and merge them from there? Every other external reporting tool works this way.