How can azure devops build pipeline be triggered when a new image is available on different container registries? - azure

Let's assume that we have 3 different container registries. Is there any available azure devops jobs/tasks that can provide a way to trigger my build pipeline when a new image is pushed on any of these 3 registries?
I have some insights with MS Flow but i want to limit the scope on azure devops.
Find a way or recommendation to trigger the build pipeline using devops jobs/tasks.

You can create in Azure Container Registry a web hook that trigger the build in Azure DevOps when new image pushed.
For this you need to write a service with Web API that handle the API Post calls. the ACR web hook send a Post call to the service when new image is pushed.
In the service you trigger the Azure DevOps build pipeline using the Azure DevOps .Net Libraries (if the service is in C#) or with Azure DevOps Rest API.
How to create ACR Web Hook? find here.
How to trigger build pipeline from code? find here.

you can have releases triggered with new images in the docker hub (reading). I dont think the same can be done for builds. You can create a release that would get triggered on the new image and that release would talk to the API to trigger the build.

Related

Update the image of azure container instance?

Azure Container instances
This is the first time i use docker image
when i trying build and upload new version code and push in Azure Container registries
but if i want to apply new version code , i must restart Container instances by manual to apply new version code , it annoys me and is a waste of time
How to resolove auto restart or redeploy when i push new version code in Container registries in Azure ?
this is log deploy azure of myself
I can think of a couple of ways to do this.
AKR Webhooks
I probably will approach this by looking at the webhooks in AKR.
Then, create a Logic App to receive the webhook call when a new image is pushed. References.
In the Logic App, you can call one of the Azure Container Instance APIs to restart the container group.
You will need to consider the security of the Logic App, which can only be called by your AKR's webhook.
CI/CD Pipelines
Assume that you have used a CI/CD platform like Azure DevOps, where you can create build pipelines.
The pipeline can build and push the images to your AKR, then create a step to run Az command to update the instance group.
I probably prefer the pipeline approach as I can see the history of what images have been released on the DevOps page.

Develop on Azure DevOps and deploy to another cloud service

We have been developing an Angular application on Azure DevOps. My company wants to have the app running on another cloud service. Can anyone tell me: Can we create a pipeline that will deploy the production version of our application from build in Azure to this other cloud service? What are the pitfalls or potential obstacles? Is anyone doing it already that could speak to it from your experience? Thanks in advance.
If you want to deploy Angular application on Azure DevOps to Azure App Service via Azure Pipelines, you could follow below steps.
Create a build pipeline, add a npm task to install the npm packages required by the Angular application
use npm task to build the application and produce the assets to be published on the web server
Add a Publish Build Artifact task that generates the artifacts which will be provided later on as an input to release definition
The last step is to add a CD pipeline which will deploy the artifacts created by the build to the Azure Web App by using this Azure App Service Deploy task. See this tutorial for details.
If want to deploy to other cloud service, this doc provides the system-defined tasks, you could review it to find if there are existing available tasks. If not, you may need to develop a custom pipelines task extension or find if there are existing extensions in the Azure DevOps Marketplace.

Adding pipeline trigger from separate project in azure

I have two projects in azure, need to trigger pipeline from pipeline in the another project. I installed the extension 'triggers azure devops pipeline' from marketplace.
Please help me with configuring this extension in the yaml file
[Please see the screenshot of my yaml file and extension]: https://i.stack.imgur.com/RGOJ4.png
The azure devops service connection dropdown of the 'triggers azure devops pipeline' extension is not displaying any value
According to your screenshot , it seems that you haven't created a Azure Devops API service connection.
You could navigate to Project Settings -> Service connections and create a Azure Devops API service connection.
Note: the Personal Access Token needs the following rights:
1.Triggering a Release: Release – Read, write & execute – Build Read & Execute
2.Triggering a Build: Build Read & Execute
Then you could get the Azure Devops Service Connection in the target task.
For more information, you could refer to the introduction of the extension.
Hope this helps.

Function App with Event Grid Trigger Binding - Azure DevOps

I hope someone is able to guide me in the right direction.
I am trying to implement the following:
Event Grid -> Function App -> Storage Account
I am also trying to implement the above through ARM templates and Azure DevOps deployment, but I am a bit confused on how to add the Event Grid Bindings to my Function App (.Net) code Files in Azure Repos.
I know in the documentation it says that i need to install the Microsoft.Azure.WebJobs.Extensions.EventGrid" NuGet package, but how is this done through Azure DevOps?
Currently my Release Pipelines are set up as follows:
1) Deploy Function App, Storage Account, Event Grid
2) Deploy Function App Code
3) Get Master Key of function app
4) Create Event Grid Subscription.
Tasks 1-3 execute correctly, but (4) fails with "URL endpoint validation failed" - which im guessing is because I havent installed Microsoft.Azure.WebJobs.Extensions.EventGrid packages correctly in my functions files in Azure repos.
When i set everything up manually and install the Event Grid trigger in the portal, I can easily create the Event Grid Subscription without issues.
How do I 'install' Event Grid Trigger NuGet Packages in Azure DevOps if my Function App code is in Azure Repos?
Much Appreciated.
I know in the documentation it says that i need to install the
Microsoft.Azure.WebJobs.Extensions.EventGrid" NuGet package, but how
is this done through Azure DevOps?
Just as answered in this thread, you need to add a dotnet restore task to restore the package and a .NET Core build task to build the extensions project before archive files.
Besides, we can install and use Event Grid Subscription Extension to create and modify event grid subscriptions in Azure DevOps pipeline.
Below blogs for your reference, hope that helps :
Automatic Subscription of Azure Functions to Event Grid
ARM Template for Event Grid integration with a new Azure
Function

How to deploy to azure app service from VSTS?

I have nodejs app. Can I deploy it to azure app service without VS or other big IDE?
So, I want an easy way to select branch what I need push it to azure and run default command for nodejs.
I'm stuck with it, because all of solution it is use VS.
You can deploy to azure app service by using Azure App Service Deployment step/task. For example:
Create a build definition
Add related step/task to build your project
Add Azure App Service Deployment step/task (Can publish using Web Deploy or upload files directly)
Select Triggers tab and enable Continuous Integration
Specify repository and branch filters
After that, the build will be triggered if you push changes to target branch.
Related article: Define a continuous integration build for your Node.js app
Regarding run command for nodejs, you can refer to this thread by using kudu API: Include node modules in azure deployment via VSTS.
This can be done. Take a look at the build and release functionality in Visual Studio Team Services.
With VSTS Build, you can trigger a build and push to an Azure Web App automatically on a Git check-in for a particular branch, or you can manually trigger the build and push.
Take a look at the Azure App Service Deploy task in VSTS build.
Note that since VSTS is pulling from your Git repo, it doesn't matter what IDE you use to actually develop your app with.
Also, VSTS is free for small teams and a single deployment pipeline.

Resources