Pipeline status on Repos/File page - azure-devops

In Azure Devops, in Repos/Pipeline page, there is pipeline status badge(right next to fork and clone buttons)
How is this badge work? I can't find any information about this feature.
Thanks.

This feature is toggled on at the Get Sources page in your build pipeline. Please refer to below pic.
If the Report build status is checked, then the build status will be displayed on source repo.
If unchecked, the build status will stop updating on source repo.(the last status will still be displayed, only not updating )

Related

Issue with updating Wokitem status using WorkItem Updater

I am using WorkItem Updater task in pipeline to update workitems automatically onces deloyment is done in release pipeline.
But I am getting "No workitems found to update" message but there is a workitem linked with build & release and it is not updating.
could anyone please give me pointer to resolve this issue. Thank you
Issue with updating Wokitem status using WorkItem Updater
I have test this extension on my side, and it works fine.
Since you do not share the configuration of your task and the info of the linked workitem, I could only provide you the troubleshooting steps to resolve this issue or you could update your question with those info.
As test demo, I have set the WorkItem Updater like below:
Then I created a workitem and set the state to Active.
Enable the CI for the pipeline and modify the file in the repo, submit the change with link the new created workitem.
The build will be triggered and the build log shows it successful:
So, if you get the message "No workitems found to update", please make sure the linked workitem match the filter for the configuration of your task.
I'm having the same issue. It finds the work-items based on the filter conditions, however its not updating the status.
enter image description here
enter image description here

How to get PR title and description from agents

Is it possible to get PR title and PR description in pipeline?
The idea is to notify team which task has been deployed. Allfeature need to be tested go to branch "development"
I tried intergrate Ms Teams, subscribe pipeline, but none of the information is useful.
Build pipeline gave me branch "development" which is not helpful (not sure what was merged into "development") and who was requested the build
Deploy pipeline gave absolutely nothing useful.
Update:
The Picture below is result of querying Builds - Get Api. Trigger for a PR was completed. There is no infomation about the PR.
If your build is based on pull request commit , the sourceVersion will be displayed next to the source branch in the build summary page.
Click on this sourceVersion, you will jump to the detailed page containing pr title and description, in this page you can also see the merged changes.
Update:
or a way to query PR title in build or release process
How about getting pr title through rest api? We can first use Builds-Get rest api to get the pull request id in the specified build.
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.1
Then through the obtained pull request id, we can use Get Pull Request rest api to get the pull request title.
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests/{pullRequestId}?api-version=5.1
The above can be achieved by adding a powershell task(call rest api through script) in the build or release process.
Update2:
The difference between PR-triggered build and CI-triggered build:
If the build is triggered by pr, the trigger reason should be pullRequest. Below is my test in Postman:

Azure DevOps - how to share one Status Badge image for any branch on GitHub?

I run an open source project and use Azure DevOps, I'm trying show a status badge to indicate if the build for my branch is passing or failing.
It's typical stuff and I've done it also with appveyor. But with appveyor I'm able to show one status badge image for all branches, master, dev, feature branches. If any of the branches the visitors happen to see fails, that same appveyor badge image is able to show the status for that branch.
I cannot seem to do this with Azure DevOps, it seems like I have to attach a branch name with the status badge image url, like this
https://fanray.visualstudio.com/Fanray/_apis/build/status/Fanray-CI?branchName=v1.1.0-preview3
where "v1.1.0-preview3" is the name of one of my feature branches. If you remove the branch name and say you happen to be on preview3 branch on github, and preview3 fails the badge won't show it as failing. If I do attach branch name to the url as shown, then I have to have an image for each branch which is not desired.
Compare this to my appveyor status badge image url
https://ci.appveyor.com/api/projects/status/github/fanraymedia/fanray?svg=true
It has no branch name attached and it shows whatever branch status you happen to be on.
How do I adjust Azure DevOps status badge URL to do the same? Thank you.
It doesn't look like there is a way to do this. This thread has some discussion of the same issue. It wasn't supported in 2019, and it doesn't appear that this feature has been implemented since.

Jenkins build status icons on GitHub Pull requests

I am integrating Jenkins with GitHub and have successfully set Jenkins to build after a GitHub push. But another thing I would like to establish is the build status icons(green check, yellow circle for pending, red "x") on the Pull request page. How do I go about to show these icons?
Here's an example from apple's swift pull request page:
In order to do this, you need to add Jenkins plugins:
github-request-builder sets the build status of a given PR in GitHub. This post is a good guide for setting it up.
embeddable-build-status hosts a project-wide image showing your overall build status:

Github multiple status checks for pull request

I have a teamcity project running a build against github repo. On completion of the build, it uses a build feature of teamcity named "Report Change Status to Github" which reports the build status using - https://api.github.com
Now I would like to have another teamcity project run a build against the same github repo and report the build status to github.
How do I make github display the 2 status checks differently? Despite the 2 builds reporting status to github, github just displays "1 pending check" or "1 status check completed successfully"
Edit: I didn't realize you already have the plug in installed, but I am going to leave the steps for other users. I think you need separate build configurations and to make sure you customize the context setting.
I was playing with this today and you can't use JetBrains "Commit Status Reporter" to do this. You can use this plugin though: https://github.com/jonnyzzz/TeamCity.GitHub
It wasn't straightforward to install--
Go here (choose Log in as guest): https://teamcity.jetbrains.com/viewType.html?buildTypeId=bt398 and
Click the "View" link in the "Artifacts" column in the latest successful build.
Then you click teamcity.github.zip and it will download a zip file
Then you upload that zip to TeamCity in the plugins section
Once you do that, go to Build Features and click "Add Build Feature" and select "Report change status to GitHub".
Then fill the form out with something like this (Note: You will need this for each build configuration you want reported. I am also running each build on separate agents which might be necessary):
Statuses are created with something called a context:
https://developer.github.com/v3/repos/statuses/#create-a-status
For each commit, the latest status for each context is shown. And for the pull request overall (next to the merge button) the latest per-context statuses of the latest commit in the pull request are shown.
This means that if you want multiple status checks to show up -- those statuses need to be created with different contexts. And that's something defined by the application which is creating statuses, not GitHub. GitHub only displays the statuses.