Comments (3)
I am also wondering the same thing. The status check on PRs in Github are based on workflow actions, but the workflow (which only triggers an Azure DevOps pipeline) is always Valid as soon as it successfully launched the Azure DevOps pipeline, even if the ADO pipeline fails or finishes minutes later as you mentioned. Still haven't found a way to get the status.
EDIT: Actually found a way. At the end of your Azure pipeline triggered by GitHub's Action, you can add a POST call to Github's REST API to add a status on the commit that will prevent you from merging in case the build completed in a failure :) https://developer.github.com/v3/repos/statuses/#create-a-status
from pipelines.
In the case of waiting for AzDO to finish before the status is returned to Github, would you be paying for 2 agents at that point? GitHub agent kicks off AzDO and sits there doing nothing but still accumulating minutes on your bill?
from pipelines.
Yes this is designed to fire asynchronously. If you sat waiting for the ADO pipeline to finish you would be paying for 2x the compute. The recommend approach here would be to have the ADO pipeline open a new status check at the beginning of the pipeline and then mark it as pass/fail at the end. Here is a minimal sample ADO yaml pipeline:
trigger: none
variables:
BUILD_URL: '$(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)'
CHECK_NAME: 'ADO/pipeline'
pool:
vmImage: ubuntu-latest
steps:
- script: |
curl -X POST -H "Authorization: Bearer $(GITHUB_PAT)" https://api.github.com/repos/$(GITHUB_REPO)/statuses/$(GITHUB_SHA) -d '{"state":"pending","target_url":"$(BUILD_URL)","description":"Pending security checks","context":"$(CHECK_NAME)"}'
displayName: 'Create a new status check on a github repo'
- script: echo 0
displayName: 'Insert your code here'
- script: |
curl -X POST -H "Authorization: Bearer $(GITHUB_PAT)" https://api.github.com/repos/$(GITHUB_REPO)/statuses/$(GITHUB_SHA) -d '{"state":"success","target_url":"$(BUILD_URL)","description":"ADO Pipeline passed","context":"$(CHECK_NAME)"}'
displayName: 'Mark status as success'
- script: |
curl -X POST -H "Authorization: Bearer $(GITHUB_PAT)" https://api.github.com/repos/$(GITHUB_REPO)/statuses/$(GITHUB_SHA) -d '{"state":"failure","target_url":"$(BUILD_URL)","description":"ADO Pipeline failed","context":"$(CHECK_NAME)"}'
displayName: 'Mark status as failure'
condition: failed()
This would require that you pass a few variables into the pipeline like
GITHUB_PAT
: A GitHub PAT with therepo:status
scope to create/update status checksGITHUB_SHA
: The commit to annotate with the status check. From GitHub this would be${{ github.sha }}
for a branch or${{ github.event.pull_request.head.sha }}
for a PR.GITHUB_REPO
: The full owner/repo_name of the GitHub repo. This would equate to${{ github.repository }}
from pipelines.
Related Issues (20)
- Make PS faster by removing the calls to get progress info HOT 1
- [Bug] expected - waiting for status to be reported
- [Question] How can I pass variables to the Azure Devops Pipeline HOT 3
- [Question] How to select stages to run? HOT 1
- [Bug] PublishPipelineArtifact fails if artifact contains a symbolic link HOT 2
- [Bug/Question/Feature-Request] Parameters passed to Pipeline are not being accepted HOT 2
- [Documentation-Request] Specify Scopes Required for PAT HOT 2
- [Question/Feature-Request] Pass template parameters for deployment at approval
- [Bug] DevOps pipeline fails when Azure function is configured to access its Storage account using Managed identity HOT 2
- [Question] Multi line Pipeline Variables HOT 2
- [Bug] Sample in README needs updating HOT 1
- [Bug] Deprecations HOT 4
- [Bug] Error when including azure-pipeline-variables paramtere HOT 1
- [Question] Is it possible to specify the Azure branch to trigger the pipeline on
- [Bug] Does not allow to parameterize the repository resource ref attribute when the resources are inside an extended template. HOT 1
- [Bug] - Cross REPO connection is not happening HOT 4
- [Bug] macOS-latest Xamarin builds fail HOT 1
- [Bug] Fix broken integration tests
- [Bug] Node.js 16 is deprecated and should be replace with Node.js 20 HOT 2
- [Bug] Could not queue the build because there were validation errors or warnings. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pipelines.