Manage API Mangement from central GIT Repo in Azure Devops? - azure

We have multiple teams working on the same Api Management instance, and the current git-based configuration that API Management provides, does not really facilitate a good process for us (with support for code reviews, pull requests, deploys etc.).
Can we use a GIT repository in Azure DevOps to control the configuration instead of having to use the repository provided directly by API Management?
Our primary use cases are:
Merge/sync changes from API Management into our central repository
Performing changes in a DevOps repo in separate branches, merge the changes to the main branch via pull requests and sync'ing the changes to API Management

We can clone the configuration repository and push changes back- using our familiar Git commands.
You can try to run the following command in cmd task of azure devops pipeline.
git clone https://username:password#{name}.scm.azure-api.net/
git add .
git commit -m "abc"
git push
Here are the document and similar case you can refer to.

Related

Migrate GitHub repo files to Azure DevOps Wikis from different project

I have a repository in GitHub and have a bunch of documentation(.md) files there.
I want to migrate the documentations into one of the Azure DevOps Wikis.
I am referring this link.
When I am using the option Publish code as Wiki,it only shows the repositories which are available inside the Azure DevOps project.
Is there a way I can publish the GitHub documentations in repositories which are from another project into the Azure DevOps Wikis?
Consider approaching this differently. If you are using git for your Azure DevOps project, then the Azure DevOps Wiki should be persisted to a hidden, but locatable, git repository. Git clone the source and target repositories locally. Then copy what you want to the target (Azure DevOps Wiki, local clone). Git add, commit, and push the added target files.
Attached images/files, if any, may be more problematic depending on how exactly they are represented in the source GitHub repo. In Azure DevOps Wiki ALL attachments are simply stored in a root .attachments folder. So, you'll need to migrate them there and "fix up" your links.
I've done this going the other direction, Azure DevOps Wiki -> GitHub Enterprise repo. You should know that you’ll likely need to “fix up” page links and that the two markdown styles have slight variations you may have to address.
Is there a way I can publish the GitHub documentations into the Azure DevOps Wikis?
for copying documents from GitHub you need to use Import repository from your devops project.
how to import an existing Git repo from GitHub, Bitbucket, GitLab, or other location into a new or empty existing repo in your Azure DevOps project.
For complete information you can go through the Import Git repo link.

A: Get notified of changes to the azure devops service

I've been looking around for a while now but I can't seem to find a way to get push messages from the azure devops team for their release notes regarding the azure devops service. I would like to be able to incorporate the changes/release notes into a teams channel (the app). I was surprised by a change to the GET git repo list api url. Which broke some stuff.
I can't really find any way to subscribe to changes to their service, other then to watch the ms-documentation github repo.
What are the ways in which you make sure you are not surprised by breaking changes?
Testing this API: Repositories - List, we can still retrieve git repositories under this project.
In addition, sprint-184-update for Azure DevOps service brings new feature: Disable a repository.
And by reference to this doc: Build Azure Repos Git or TFS Git repositories, Azure DevOps enables some limitation to Azure Pipelines regarding to Azure Repos Git repository like Limit job authorization scope to referenced Azure DevOps repositories. Please check it.
Update>>This API: GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=6.1-preview.1 does the same thing to retrieve git repositories.
And Azure DevOps service doesn't provide notifications about repositories changes(Add, Delete), see: Supported subscriptions for details. Also currently official released APIs list here: Azure DevOps Services REST API Reference.
BTW, you can create a new suggestion ticket here. The product group will review these tickets regularly, and consider take it as roadmap.

Azure and GitHub Connections are not well synced

While creating a project in Azure DevOps , the repository connection to the GitHub has been pointed.
But if you push any code the GitHub repository, this update is not seen from the Azure DevOps Reps view.
Even the creation of the new branches at GitHub site are not shown in Azure DevOps.
This is because it doesn't do what you think it does. Connection is not supposed to sync content across repositories. Its "just" being used to connect to the repository on the build agent and pull the sources. If you want to sync repos in Github and Azure Repos you'd need to implement a custom solution. Nothing built-in exists in Azure Repos or Github.
https://learn.microsoft.com/en-us/azure/devops/boards/github/connect-to-github?view=azure-devops

Azure Repo submodule CI/CD

In my Azure repo for my function app, I included a submodule that is cloned from another Azure Repos. I try to enable CI/CD pipeline of this function, however, if I change and commit a new change to the submodule's original Azure repo, it cannot trigger a new build and deploy of the function APP. Is there a way to enable CI/CD for Azure repo submodule change?
For this issue, you need to enable the Checkout Submodules option in the advanced section of the Get Sources step.
You can refer to this document for details.

Gitlab pipeline checkout access

I'm trying pipelines in git lab community edition.
For what I can understand, from gitlab, the code and pipelines live in the same git repository.
In my scenario the pipelines are responsibility of devops team and code from develop team.
How, in git lab, is possible to prevent developers of changing the pipeline?
I understand it's possible to add devops team as maintainer to review pull requests, but this will create a dependency of devops teams in every change.
thanks
GitLab is not really designed for the scenario you describe. The general idea is that developers look after the CI configuration themselves.
You could try using the includes feature to store the bulk of the CI configuration in a separate repository.
In the application repository you would have a .gitlab-ci.yml file that pulls the CI configuration in from another repository using include-project:
include:
- project: 'my-group/my-ciproject'
ref: master
file: '/ci/.gitlab-ci-myappproject.yml'
Then in the my-group/my-ciproject repository you would have a file .gitlab-ci-myappproject.yml that contains the GitLab CI jobs configuration.
build:
script:
- dobuild
Only the DevOps team would have access to the my-group/my-ciproject repository so developers can't edit the CI config (although could mess with the .gitlab-ci.yml` file in the app repository).
Alternatively you could protect the master branch and have all changes approved before merging to master. Then developers would not be able to make changes to the CI without an approval.

Resources