Add TFS Build status to github - github

I've user Azure portal to setup continuous integration for my Web App. Sources are hosted on GitHub.
When I click GitHub project->Code->Branches, I see build status for master branch:
All very nice untill now. However, I've manually setup CI build on dev branch in VSTS, but it is not shown in github.
How do I report build status back to github, so I will see it on dev branch as well?

From the piture you posted above, you have pushed 7 commits for master branch, no commits for dev branch. Now you set up a CI build in VSTS to build your project in dev branch. Make sure that Trigger path has set to dev branch correctly in your build definition. Then you push a commit for dev branch, this build definition will be triggered and you will see the build symbol in GitHub.
In addition, the symbol appears only for CI build, if you manually trigger the build VSTS, it doesn't show.
Build definition trigger:
Build definition repository setting:

Related

Azure pipelines running version of build pipeline on build policy

Which branch does the build pipeline runs on a PR? I mean, you can set a build pipeline to run during a PR, but the docs doesn't clarify from which branch version does this pipeline will run. My teams doesn't use gitflow, so for sure it isn't the "default branch" settings (because my build pipeline doesn't even exists on the default branch of the repository (main). On the following image it's my current build policy settings:
supose my fraudchecker-build exists on branches A,B and C. Each branch has a differen't "version/code" of this pipeline. How can i know, when i set a build policy, which branch the fraudchecker-build will execute during a PR: A,B or C? I can't assume it will be the current branch where i'm setting de build policy (supose it is branch D)
doc page:
azure pipelines doc page
The pipeline will build and validate the code from the source branch i.e. if you create a PR to merge branch B into main, it will build on branch B code
Edit - AS Vince stated I've simplified it too much in my post. It runs on the combined code of the source and target branch i.e. what the target branch will look like post PR completion

Merge GitHub branches from Azure

I am setting up CI/CD at work and there is one step I’m not sure how to do and furthermore, if it is a right thing do.
For background, I am used to develop in C# with Visual Studio, source code in TFS and deploying with basic script that copies files on the intranet.
Now, I’m requested to setup Build and Release pipelines on Dot Net Core projects in GitHub.
I have three branches on this project: DEV, RELEASE and MASTER
I created one pipeline that triggers on DEV’s commits, creates an artefact and deploy to DEV server.
Those are the pipelines that deploy all developers work to a DEV server where they run their own tests.
Next step, when we want to deploy to staging servers, we click a button in Azure, this merge the DEV branch to the RELEASE branch but I know close to nothing in GitHub, not even sure those are the appropriate words.
When the merge is done, this will trigger a build pipeline that will create a different artefact, when this artefact is updated, deploy to staging server.
Once this release is validated on Staging and Quality, we would merge RELEASE to MASTER and do the same until PROD servers. It is all on intranet and self-hosted agents.
Is that a good way of doing things? Can it be done this way? I need a PowerShell task or is there something that exists?
If you are using Azure DevOps pipeline, the pipeline should select GitHub for repository type, then we can configure the CI trigger.
a. Configure CI trigger:
Classic steps:
1.Open project setting->Service connections->select GitHub-> create a new GitHub service connection
2.Create a new build pipeline via classic editor-> Select GitHub as the source.
3.Open pipeline->select the tab Triggers-> enable the option Enable continuous integration and configure the Branch filters
b.YAML steps:
1.Open project setting->Service connections->select GitHub-> create a new GitHub service connection
2.Create a new build pipeline and select GitHub(YAML)
c.The sample of Check out GitHub repositories in your pipeline
resources:
repositories:
- repository: MyGitHubRepo # The name used to reference this repository in the checkout step
type: github
endpoint: MyGitHubServiceConnection
name: MyGitHubOrgOrUser/MyGitHubRepo
trigger:
- {branch name}
Configure CD trigger:
Please refer to this doc to configure the release trigger.
If you are using GitHub action.
Please select the correct workflow to configure the CI/CD, Please refer this doc for more details
CI sample:
on:
push:
branches:
- ' DEV'
Update1
When Dev branch is updated, it is built and deployed to Dev server by pipeline.
Create build A and release B, configure the CI build trigger, when the branch Dev is updated, it triggers the build pipeline A, and when build pipeline A is completed, it triggers the release pipeline B.
click a button to synchronize Dev branch to Release branch.
We cannot see the button, as a workaround, we can add task powershell and call the API to create pull request and complete the pull request. We also can add task cmd and publish the code via git cmd

SonarCloud check status not available in Github

Currently, I'm using SonarCloud to analyze some of the repositories in my project. But in some of them, the check status is not present (I want to make this mandatory).
The CI/CD server is CircleCI and SonarCloud it is working ok (PR branch is available).
In order to activate Github webhook, you must check that
The project in sonar has the icon of GitHub (relationship it's ok)
You have to create another branch and make a Pull Request
Call the Gradle task with PR params
./gradlew -Dsonar.pullrequest.branch=${CIRCLE_BRANCH} -Dsonar.pullrequest.base=master -Dsonar.pullrequest.key=${CIRCLE_PULL_REQUEST##*/}
Make sure that any of your repos don't override project keys

Build trigger is not invoked on push for Azure Git repositories

I have my git repository hosted on Azure DevOps. I created a new yaml based build pipeline in the master branch and have set the trigger section to two existing branches. Other branches don't have a azure-pipeline.yml file nor any kind of branch policies are set for this DevOps project.
trigger:
batch: 'true'
branches:
include:
- master
- develop
The trigger gets invoked for every change in the master branch as expected. But is ignoring any pushes to the develop branch.
If I configure a build pipeline with the visual editor and define the exact two branches there, for every push a build will be triggered.
Any idea how Azure Pipeline respects the build definition also for other branches without copy and pasting the whole definition for every possible branch?
Build trigger is not invoked on push for Azure Git repositories
I have created a sample with the syntax:
trigger:
batch: 'true'
branches:
include:
- master
- Dev
And it works fine on my side. Then I check the new project you provided, but I found that the .yml file is incomplete and does not contain a trigger: node.
So, to resolve this issue, we need to double check the .yml file you modified in under the master branch, and you build .yml file is you modified.
Besides, when we edit the build pipeline, there is a extended button, we could select the option Triggers to set the build trigger with visual editor:
If above not help you, you can try to create a new build pipeline, set the trigger only with Develop branch, check if it works fine, then return to the previous with master
and develop branch.
If all of the above methods are not worked, you may need share a detailed sample and some steps, the reason for this problem may be hidden in the corner we ignore.
Hope this helps.

TeamCity deploy previous build

Is it possible for TeamCity deploy config to deploy build version before most recent ?
My source code is on GitHub and I have a TC pipeline consisting of a build config and a deploy config.
On creation of PR, that branch is built ( but not deployed ).
On merge PR to master, master branch is built.
Deploy config only deploys builds of master branch and is triggered by successful build of master branch.
For troubleshooting purposes, I'd like to deploy a previous master build.
Is this possible ?
It really depends on how your build is setup. If the deploy config content is also in source control, then you can try tagging the master branch revision you want and giving teamcity that tag as your branch input to build when you trigger the deploy build. If you have a snapshot dependency on that deploy build, then it will queue the build it depends on with the same branch input parameter except it finds a suitable build (if you configure it to use a suitable build).