Backtrack deployed work items in TFS - tfs

In TFS, when I link a work item in a PR, the PR gets approved, merged and the a CI deployment is performed, then I bet TFS should be able to see that the linked workitem(s) have been deployed production. I shouldn't have to look into master or develop branch to see if the code I am looking for is in place.
So, when looking at that particular work item (in epic, on board, wherever) I should be able to see some kind of deployment status.
Is that an out-of-the-box feature or does that require a plugin?

Actually the "deployment status" can be checked with the linked Pull Request and commit.
Once the PR gets approved, merged and the CI deployment is performed, the code changes will be checked in. Normally we can check if the code changes are really there by navigating to the specific merged branch.
Actually, when you looking at that particular work item, you can check the linked PR and commit to know the deployment status.
When you link a work item in a PR which is not approved and
completed, then you can see that there is only a Pull
Request with the ID under the All Links tap in the work item.
Once the PR is approved and completed, you can see that there is a
commit linked to the work item.
So, when you see a corresponding Commit linked there, that means the changes are deployed. You can also double click the linked PR and commit to open them to see the change details.

Related

How can I restore a work-in-progress PR in Bitbucket Cloud?

I spent a lot of time describing my changes in a PR in Atlassian Bitbucket online, but my PC blue-screened before I could create the PR. Is there any way I can recover the description? If not through Bitbucket, perhaps through Google Chrome?
I tried looking in the repo's list of existing (created) PRs. I also tried creating a new PR from scratch with the same settings, hoping the description that I'd spent so much time on would automatically populate (Atlassian does that sometimes), but no luck.
Sadly, the answer is probably not.
One major downside of BitBucket's Pull Request feature (compared to competitors like GitHub) is that it lacks a Draft PR capability to explicitly mark a PR as not yet ready for review. The description information in the Create PR interface for BitBucket Cloud only exists in your browser until you click "Create Pull Request" for the first time. You CAN continue to edit the description after creating the PR, but some developers prefer not to "edit in public".
As an added complication you might not yet have seen, even without a browser crash you can get into trouble in the Create PR interface if the source branch changes. I.e. pushing additional commits to a source branch while you're editing the description in the Create PR interface for that branch gives you a popup with two options, BOTH of which result in the loss of your current description text.
Other alternatives:
Craft your description text in a private editor (possibly one with markdown capabilities) and save to your local disk, then paste into the BitBucket Create PR description box as the last step. This is probably the most reliable solution.
Adopt a naming convention with your repo reviewers for PRs. For example in our team, PR's with a Title prefixed by "WIP:" are understood as work-in-progress that is not yet ready for review.

Github PR Checks Without Disallowing Pushing

Please read carefully as I believe my use case is unique and I have tried searching a lot on how to do this, but I am still unsure.
Generally, I am trying to set up a repo for a group of developers to work on and have it contain CI checks and require reviewers. However, I have run into some issues with how Github enforces branch protection. On top of that, I cannot use Actions as we are using a self-hosted Enterprise Github through an organization.
My desires:
Use Jenkins (which is already set up and building) builds as checks for PRs. If the checks don't pass, you cannot click merge on the PR.
Allow pushing to a branch that I have a PR up for so the author can push changes based on PR comments.
Require two approvals from maintainers. You cannot click merge without these.
It seems I could protect a master branch for example. However, I would like to enforce the PR checks whenever a person chooses to make a PR. For example, from one dev branch into another dev branch.
Use case:
An author sets up a PR for merging a branch some-work into dev. Jenkins builds the HEAD of the branch some-work to evaluate the checks. I would like to enforce this PR to have two approvals from maintainers. So, those reviewers make some comments and request some changes. The author makes those changes and pushes a new commit to the some-work branch. Jenkins runs on the new HEAD to reevaluate the checks. Then, if-and-only-if the two reviewers approve and the checks pass can the merge button be clicked.
What I have tried:
Using Github branch protections: the required approvals and the required status checks. However, this prevents any pushing or force pushing to the branch being developed on. I could just apply these protections to master, but I also want these checks part of any PR (even dev2->dev1, for example).
Github actions, but these are not available in the self-hosted enterprise Github I have to use.
What I understand:
I understand that I can protect master, for example, in this manner with the native Github branch protection. However, if I want master to be something that always works, it is understandable that developers would break up a feature into multiple branches. They would also want their follow developers to review it when merging it from their branch to an intermediate (non-master) branch. Then the actual branch being merged into master consists of code written by many developers.
Thank you all in advance for your time and help. :)
Using Github branch protections: the required approvals and the required status checks.
However, this prevents any pushing or force pushing to the branch being developed on
But... that issue (not being able to push a protected branch) could be part of a possible solution.
I would make jenkins create/reset a PR branch based on a push on a topic branch (like some-work-pr, based on some-work)
some-work is not protected, and can receive commits at any time
some-work-pr is created by Jenkins protected, and cannot be modified: compilation/test/review/approval happens here.
PR would only be done from xxx-pr branches (protected PR branches created/managed by Jenkins), while other topic branches continue to evolve.
You can only enforce these policies with branch protections, so if you want to enable required CI checks before merging a PR for all branches, then you need to protect all branches (e.g., with the pattern **). In that case, you'll need to have developers use a forking model for your repositories so that they can push code to their forks and then merge in the changes via pull requests only.
Note that if you adopt an approach where projects are implemented as a set of small, incremental changes that are merged frequently and use feature flags to control whether the code is enabled, then as a practical matter developers will only merge into the main branch and you can get away with only protecting the main branch.

How to see the builds & releases from within the PBI / BUG details page?

Currently the links tab of a PBI (or BUG) shows the commits as well as the pull requests but I would like to see the build in which those commits were included as well as the releases of that build (when it was released and to which Server)
In short, is there any way to configure TFS to see the build and release details from within the PBI/BUG Details page?
Currently our approach to find out whether a specific PBI has already been deployed, is to start from the Build and Release menu and to click through all recent releases and their builds until we find the PBI we are interested in. That is not an efficient Approach.
I found this and consider it as the answer to my question.
https://blogs.msdn.microsoft.com/devops/2017/08/25/automatic-linking-work-items-to-builds/

How to automatically link work items to the build?

I noticed that work items can be linked to a build. But I don't see a way to automatically link the work items to the build.
On pull requests, we require pull requests to be associated with a work item. When the pull request is complete, the work item is updated with a link to the commits.
If I look at a branches commit history in TFS, there is a build column. I assume that the build column would contain the build that the commit is in, but it is always blank.
We want to be able to look at a build and see what work items are contained in the build.
Is there a way to do this?
The “Automatic linking of a build with associated work items” feature was released in TFS 2017 Update 2. You could enable this feature by toggling the setting under Options in your build definition:
In this way, each successful build associated with the work item automatically appears in the development section of the work item form.
More information you can refer to the blog below:
https://blogs.msdn.microsoft.com/devops/2017/08/25/automatic-linking-work-items-to-builds/

How do I associate a review request with multiple changesets in TFS 2012

Our development process works like this: Every 2 weeks the team lead (me) goes in and reviews everyone's changesets to make sure they are up to the coding standards. I would like to use TFS 2012 to help automate this process.
There are 2 problems with this:
There is no way to submit an unsolicited code review. I can live without this if necessary, I guess
There is no way to associate a code review with more than one changeset. This is a deal-breaker
I read one article which said it's possible to link changesets to a work item after the fact and when I open the work item for the request review I do see the Links tab. However, when I click "New" or "Link to...", there is no option to link to a changeset. There is only an option to link to each work item type in the process.
Does anybody know how to do this? Are there any plans to add these features to TFS?
Here's a screenshot:
Unsolicited, no.
You can rightclick a changset in the history screen to request a review post checkin.
And there is a nasty workaround to get what you want to achieve. Check out all files you want to review and request a review. You can then undo your checkout, the shelveset and the review request will remain.
Alternatively you can just go to the source control tab and do a checkout-all on the rootfolder of your solution, request the review, undo your checkout and do the review.
As for linking changesets to a Work Item, this can be done post checkin. Open the work item, go to the links tab and click "Link to..." The dropdown there will have a "Changeset" option. But I don't think this link type is enabled for Code Review Requests, since these use a Shelveset and not a set of changesets as the source for the code to review.
I expect you could use the TFS API to generate a shelveset with all the changes from a specific developer in a given timerange, put these on a shelveset and request a review on that. But no existing feature to do that exists.
Or you might be able to edit the shelveset of associated to the review by creating a new one with the same name.
An alternative approach:
1) at the beginning of the two week cycle, initiate the code review process and note the work item number that is created. Simply request a review from yourself with no code changes at first.
2) Have all your developers associate their check ins for the next 2 weeks with that work item #
3) When you are ready to perform the review, simply open the work item and go through the changesets.
That should accomplish what you want.
Option #3
[I'm assuming here that the changesets that your are trying to associate to a single code review are consecutive, for example 20001:20010]
I "roll[ed] back to a specific changeset" (in my example above
20001). I check it in the changes. The code is now in its original
state.
Then, I "roll[ed] back to a specific changeset" (in my example above
20010) and check it in again. The code is now in its final state.
Finally, I request a review on the latest revision. This review
compares the latest two commits - the ones I created from the
rollback.
As a bonus you can compare specific changesets in the history page. You can use this compare to make sure that the commits above did in fact revert the code to revision 20001 and 20010.
On item #2, I have a standard work around that you might like to combine all changes from many changesets into one shelveset for review. I tried the checkout method mentioned above and ran into issues, partly because my review had 25 files or so and after checking them out, if I refreshed, TFS removed them from pending changes because it TFS's opinion there were no changes.
First, (assuming that your changes are already checked in, and in multiple changesets), have a workspace with the latest files on a disk path such as D:\Latest...
Create a new "local" workspace (called "Review"), map the same project to the slightly different path (say, D:\Review...") get all the files. Go to the history of that project and just before your earliest changeset, right-click and select "Get this version".
At this point, go to the history and rollback any changesets that someone else may have changed in the meantime, if any, that you don't want to be part of the review, unless someone changed a common file. Leave those.
Using beyond compare, compare "D:\Latest..." to "D:\Review...", copy your changes from Latest to Review. Go into the common files and copy only the lines that you want reviewed. When Beyond Compare writes out the changes, TFS will detect the change and put the file you save in your pending changes list for the "Review" workspace. (That's a feature of local workspaces.)
At this point, you just shelve your pending changes from the "Review" workspace, and request a review on that shelveset.

Resources