I am using TFS 2010. In the build process template, I add a new workflow activity InvokeProcess to run a batch file. I need to set the working directory of this InvokeProcess to the workspace directory of the Build agent. Is there any way to do this?
Should be able to use workspace object. Just type workspace and intelisense will kick in. This is built in object that holds the path to the build workspace. Others available are sourcesdirectory and binariesdirectory. Spelling maybe wrong not in front of a pc
I follow this answer and get it resolved: https://stackoverflow.com/a/9564712/3918598
Basically, you will need to create a new local variable SourcesPath at the outter most scope and then consume it wherever you want. Do not name it SourcesDirectory because that name has already been used by some inner activities.
Related
I have recently installed Jenkin autodeploy tool. But I want to change it's default workspace location path which is pointing to my installable directory(c:) but now I want to keep my all projects in other drive so for that need to change workspace location.
But in my jenkin portal I am not finding that option.
Can anyone suggest me where can I find that?
Please see screen shot as well.
See Here
Thanks
Vijay
This option was removed in 2.121:
Build Record Root Directory and Workspace Root Directory can no longer be configured through the UI as these options were generally unsafe to use while Jenkins was running. Instead, these locations can now be customized using system properties on startup. Existing changes to these options will be retained unless and until overridden at startup.
Further details under JENKINS-50164.
Under the new model, one sets the workspace root with the hudson.model.Slave.workspaceRoot system property, which can be set as follows:
-Dhudson.model.Slave.workspaceRoot=/whatever
The exact mechanism for setting a property like this varies by OS/platform, but many typical options are described here. The full list of available system properties is on the Jenkins Wiki.
Since I also couldn't find under Jenkins -> Manage Jenkins -> Configure System the Advanced option. Where you can add a different directory for Build Record Root Directory.
You can change this property directly in the config.xml in the root folder of your Jenkins.
Here you can update the property to what you need to.
I would recommend using the following structure,
/path_to_the_folder/${ITEM_FULLNAME}/builds
Because using ${ITEM_FULLNAME} in the path, will put the builds of every job into its own folder.
I'm trying to set up a parameterized build.
One of the build parameters is the branchname, where I want the TFS plugin to get the project from.
Is it possible to pass an build parameter to the "project path" variable of the TFS SCM plugin. (If yes, how? I have tried several ways, but it doesn't seem to work)
This variable:
TFS Project Path
I don't think it's possible to use variable for Project path in Jenkins. The Project Path requires the name of the project as it is registered on the server. There is nowhere to define the variable.
The description of Project path is:
The Team Project and path to retrieve from the server. The project
path must start with $/, and contain any sub path that exists in the
project repository.
Check: https://github.com/jenkinsci/tfs-plugin/blob/master/README.md
You can use a "build-parameter":
and user this parameter in the TFS-settings:
But in my case I want the TFS-plugin check the TFS for code changes every 15 minutes and trigger a build if code changes were detected. Using this configuration the plugin triggers the build every 15 minutes also if there are no code changes.
In jenkins, how do I design a plugin to take user's input on where to create the workspace on the filesystem?
I came across WorkspaceLocator but not sure how to use it. An example would be great.
[edit]
I want to be able to do this from the plugin's code. As in, for a particular type of project, the workspace should be created in some hard coded location that is declared in the code.
You can change the workspace at Advance Project options -> Use custom workspace under your job configuration.
We are currently setting up Team Build 2010 for our company, and I am trying to use workflow activities to retrieve the exact local path to the current solution being built. I haven't found a way to get this value, does anybody know how (without writing a custom activity)?
Either one of server or local path would suffice (i.e $/TeamProject/Branch/OurProject or C:\TeamBuild\src\path\to\branch\OurProject) since we can use the conversion activities on the server item.
The reason we need this path is for updating version info files, and that needs to be done for only the current solution being built, and the files have the same names (AssemblyInfo.cs, for example).
In this similar question, the solution is to define a parameter, but since this information is particular to the solution being built and not some external path, we were hoping that this info would retrievable.
You can retrieve this particular info without adding anything. If you navigate within your Build Process Template to the position where MSBuild breaks out, you will see that the solution that shall be build is set as a string named localProject. This will contain the local path where TFS has downloaded your SLN, something like C:\TeamBuild\src\path\to\branch\OurProject\OurProject.sln.Open the XAML and navigate to:
Run On Agent
Try Compile, Test, and Associate Changesets and Work Items
Compile, Test, and Associate Changesets and Work Items
Try Compile and Test
Compile and Test
For Each Configuration in BuildSettings.PlatformConfigurations
Compile and Test for Configuration
If BuildSettings.HasProjectsToBuild
For Each Project in BuildSettings.ProjectsToBuild
Try to Compile the Project
Compile the Project
Run MSBuild for Project
if you select Run MSBuild for Project & hit F4 you see it.
In order to retrieve what you are after you can define another string-variable solutionPath in your Build Process Template & insert under the Run MSBuild for Project a new Assign activity withTo : solutionPath andValue : Path.GetDirectoryName(localProject)
Have you looked at the TFS Community Build Extensions, they give you a assembly versioning out of the box?
You can use the variable called SourcesDirectory to get the current Source Directory on the Build Server. You can also use an ConvertWorkspaceItem activity to convert between server and local paths.
There's also a blog post that cover's all of this here.
I have several projects in my TFS collection and I want to perform checkin during build of one of the project. I have build template and I'd like to use tf.exe with InvokeProcess activity. But how can I specify source files and destination project folder in command-line arguments of tf.exe? Or I need copy files manually to destination project folder?
You should be able to set the WorkingDirectory property of the InvokeProcess Activity to the folder where your Workspace on the server is. You may need to the ConvertWorkspaceItem(s) Activity to convert it to a physical path on the server (i.e. C:\Code from $/Server/Code). If you've not done this before, you may need to create a Sequence activity to perform the 2 steps; you can then store the output of ConvertWorkspaceItem in a variable scoped to the Sequence, and use it as the WorkingDirectory of the InvokeProcess.