Select and Insert TFS build number into TFS database - powershell

I am trying to create custom build version number.
We already using some custom build template and have created custom activities. Now I am trying to add custom build version activity in our template.
My idea is to select last build and extract only number which represent number of builds. This is last digit and it can be e.g. 5.2.3.1032 (marked as bold).
Based on last digit I will create next build number and insert into TFS database.
I can also use UpdateBuildNumber activity to insert number, but is there way to select build number by querying TFS db directly? It is also good if is possible via PowerShell.
Thanks

It sounded familiar, in fact I wrote a post on this topic a while ago. Probably the code and details must be reviewed to work with recent TFS, but the general idea is still applicable.
At the core you use the IBuildServer.QueryBuilds method to read your build history and pick the information you need.

Related

How can I pull a report of effort by person in Azure DevOps under the Scrum template?

In Azure DevOps, I need to pull a report of the work done by person in order to distribute payments between team members.
Since the VSTS does not support rollup of the Effort directly:
I suggest you use query to pull out the report of effort for all teams first, then download this report and roll up the effort by person.
Step1: Go Query page, then add Effort column by open Columns Options:
Note: This steps is very import, this can help for pull out a report which contains the Effort field.
Step2: Create a query like below shown:
In the value of State, just input the states which represent the work done in your project. For me, there has 2 states can represent the work has been done: Done and Closed. For Assign to, you could specify the group(s) name which cover the all person you want to check in value blank.
Step3: Download this into CSV by using the button Export to CSV:
Steps4: The above step would generate a excel in local. Then you could apply the Pivot table into that to count the effort by
person.

Exporting individual Congos Reports via command line

I'm trying to work out how I can export individual Cognos Reports via the command line, for the purposes of source versioning in Git at a report-by-report level. I presume XML would be the output format.
I read that the Cognos SDK can help but you need to build your own solution, which may be possible but this use case feels like something many others would already want and there'd be tooling already.
Of course, importing the individual report would also be needed.
Can anyone help here please?
Thanks.
If your end game is version control (Who changed what, when?), you should look into MotioCI. Last time I looked, there was no free version of MotioCI.
You can use tools like the ones provided by companies like http://www.motio.com. With the free version you can export the XML of the reports but only one by one.
You can also use a Cognos deployment of the reports that generates a zip file with the XML of the reports, but all the reports are in the same file and you will have to extract the XML of the individual reports by hand.
I found the SDK to be cumbersome and, when I got it working, slow.
Yes, report specs are XML.
I have created a process that produces output like what you are asking for. Here's what it involves:
A recursive common table expression (CTE) query to get the report
specs along with the folder structure as seen in Cognos.
A PowerShell script to run the query and write the results to the file system.
Another PowerShell script to pull the current content from the remote git repo, run the first PowerShell script, then add, commit, and push the results up to the remote git repo.
I also wrote a PowerShell script to perform the operations associated with git push. This involves using a program I found called HTML Tidy (http://tidy.sourceforge.net/) that can be used to make the XML human-readable. This helps with diffs in git. I use TFS, so I get a nice, side-by-side diff if I have tidied the XML. (Otherwise, it tells me the only line of XML has changed.)
I recently added output for dashboards (exploration) and data sets (dataSet2). Dashboards are stored as JSON, so my routine had to tidy that (simple in PowerShell).
I run my routine daily, getting new and modified content from the last 3 days (just in case), and weekly to do an entire dump (to capture the deletes). The weekly process takes about six minutes. The daily process is negligible.
Before you ask: I hesitate to provide actual code because I can't take any responsibility for your system.
Updates:
Hacking away at the Content Store database is not recommended and it is not supported by IBM.
For reference/comparison: I'm running IBM Cognos 11.0.7 on IIS on Windows 2012 R2 with the Content Store database on MS SQL Server 2016. Your system may be different.
Additional Resources
https://www.cognoise.com/index.php/topic,28289.msg113869.html#msg113869
https://www.cognoise.com/index.php/topic,17411.msg50409.html#msg50409
https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6
https://learn.microsoft.com/en-us/sql/t-sql/language-reference?view=sql-server-2017
https://git-scm.com/docs
http://tidy.sourceforge.net/

Change Properties of multiple diagrams in Enterprise Architect

I would like to change the properties of multiple diagrams together rather than clicking on them one by one. Does anyone know how this can be achieved?
You can use the scripting facility of Enterprise Architect to loop the diagrams you would like to change and update them.
See this section of the manual to get help.
There is a bunch of example scripts included with EA, either from the local scripts, or from the EAScriptLib MDG.
Another source of examples is my Github repository: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library
You could write a SQL to manipulate your database. t_diagram.PDATA holds a long cryptic string where one part is ScalePI=0; (which is the default for no scaling). You can alter that to be ScalePI=1; (meaning scale to one page).
String manipulations vary from database to database. So you need to write your own which you can execute in a script using
Repository.Execute("UPDATE t_diagram ...")
Note that you should test this in a sandbox first since invalid SQLs can easily disrupt your whole repository.

Is it possible to set the seed of the ID in TFSO

I have migrated my local TFS project to TFSO. Unfortunately I could not use the OpsHub migration tool because the language of the local instance was German and therefore the work-itemscould not be transferred. I have introduced a lot of references to work-items in source-code. The problem is that now the ids starts with 1, resulting in references from code to work items that are not related.
Is it possible to set the ID in TFSO to a specific number in order to have newly created work-items to start with that number?
No, there isn't any way to changeset or specify the Work Item ID. It is controlled by VSTS.
And the reference link between the changeset and workitem is stored in the workitem. So if the you haven't migrated the work items, don't worry about the incorrect reference for the code and work items.

Given code base hosted on TFS, which command can tell me which file has changed most?

I want to find out files under a given directory which have been updated most. Is there any command which can display this info? Or is there any way to get max version count for a given file, so I can write some script to get this info from all and then sort desc.
Do you mean changed the most number of times, or undergone the most code chrun?
Either way - looking at the report data might be the easiest option for you. Take a look at the following blog post I did explaining how to use Excel for looking at TFS data that uses churn as an example allowing you to drill down into folders and files - but you should be able to get the data that you are looking for.
Getting Started with the TFS Data Warehouse