Get the name of the file I upload to a Repos Azure and then add it to a pipeline task - azure-devops

I would like when I add a file to Azure Repos a pipeline is automatically triggered and publishes the file I just added.
Is it possible to do this?
Thanks in Advance

Related

Azure DevOps - can I specify the location for the automatically-generated pipeline?

When I push a new repository with an azure-pipelines.yml file in the base folder, a pipeline is automatically created. When I view the Pipelines page, I see that it is it is created at location (root)\($projectname)\($projectname).
Can I configure the yml to create the pipeline in a different location, or do I have to do this manually?
You may add any path here (under review your pipeline YAML):

Azure DevOps : I want to add a task in my pipeline that can copy some files from my Azure Repo into an On premise VM. Any leads?

I have a requirement to create an Azure DevOps pipeline that can copy files from my Azure Repo to a path on an On-premise VM (a SQL server to be precise). Could anyone advise on how to get started on this?
You would need to add a checkout task to the pipeline. You would define the repo as a source and then add a step to checkout the repo. Here's some documentation concerning checking out multiple repos using yaml that should get you started

DevOps repo create event

is there a way how to listen DevOps repo events about repo creation.
Idea is to automate pipeline creation right after when a repo is created and it has a pipeline directory.
DevOps doesn't have such a built-in method to achieve your requirements:
https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops
But you can do something like this:
1, Create a time trigger azure function to capture all of the repo in your project.
2, Compare the current repos and previous repos each time with the last.
3, Create pipeline when you found the new repo created.

Azure DevOps - How to update pipeline repo source without re-create a new one?

I am planning to move my Azure pipeline source files to a new Azure repo. How can I update the existing pipeline setting to point to the new Azure private repo location? I prefer not to re-create the repo and variables. Right now, if I edit the current pipeline setting, it would only allow me to select .yml files from the current repo. There's not option to change repo.
Thanks
From your description, the pipeline is Yaml type.
You could navigate to Triggers -> YAML -> Get sources.
Then you could select the target Azure repo.
If the Yaml file has different name, you could also select the target yaml file in the Settings.

Create Azure pipelines from scripts

I was playing with Azure Build pipelines. My Goal was that Developer should be able to create a Build Pipeline for their project. But he/she will not be creating it via Azure DevOps console, instead, they would Trigger a build job which would create Build pipelines for them. I was able to achieve it by having a common Template.json and invoking it using PowerShell scripts.
But I see that we can create a build pipeline by having an azure-pipelines.yaml in our repo. So I have two issues which I am struggling to face.
An Azure pipeline job that will read the azure-pipelines.yaml and create a build pipeline for the user.
Read the Azure-pipelines.yaml file which is kept inside the sub directories in the repo.
Appreciate your help.
Thanks.
Resolved :)
Created a powershell script which uses the json file which was exported from a existing pipeline job.
The JSON file will be using the azure-pipelines.yml file to create the tasks.
The Powershell script updates the json file and makes a rest call to create a pipeline.
The documentation is very poor . I was unable to find documentation on creation of pipeline through code . I Checked the Request body while saving the pipeline from which I was able to get the details to refer the yml file .
You can use AzurePipelinesPS to Get-APBuildDefinition and Publish-APBuildDefinition.
The functions use return and post json objects. I modify the json templates with tokens and update them are needed. Format-APTemplate will replace the tokens in the json template.
There are functions for release pipelines as well; Get-APReleaseDefinition and Publish-APReleaseDefinition.