Tag external git repository after Azure DevOps release - azure-devops

I am quite new to Azure DevOps and here is my situation.
Build Pipeline (BitBucket connection)
dotnet build
dotnet pack
publish artifacts
Release Pipeline (Manually Triggered)
dotnet push
How to ?????
Question: How to tag the bitbucket repo after the release?
I have looked for answers and only tagging solutions i found were for TFS/VSTS repos but can't find much info on tagging bitbucket repo from release pipeline.
I do have a plan B if i don'd find a simpler/elegant way of doing this.
Plan B:
Build Pipeline (define git repo url and credentials in variables)
git checkout via powershell using repo url and credentials from variables
dotnet pack
publish artifacts
Release Pipeline
dotnet push
git tag & git push tag from powershell script using repo url and
credentials from variables

Related

How to copy files from one git repo to another git repo in Azure pipelines task?

There is one public source repo in github where all the source code is present. There is another github repo of mine which has some configuration files.
I want to run some tests of source repo using the configuration file present in my github repo using Azure pipeline task.
How can I checkout to source repo of github first and then do initial setup like build in that repo? And after that copy configuration files from my another github repo to the source repo directory and run tests of source repo.
I want to do these steps in Azure yaml pipelines as from azure release pipelines not all the artifacts are accessible.
Checking out multiple repos is possible, also with GitHub as a source, but don't forget to setup a GitHub service connection.
More info and options about this see: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#specify-multiple-repositories
Since you want the GitHub repo to trigger the Azure DevOps pipeline, please check out the feature that is available since October 2022:
https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/github-actions?view=azure-devops

How do I download GitHub Artifacts from Azure DevOps Release Pipeline

I have a GitHub workflow that creates Artifact(s). I also have a last step within that workflow that triggers an Azure DevOps Release Pipeline. I modified an existing release pipeline to change the artifacts from an ADO Build Pipeline to GitHub (and made the service connection in ADO).
- uses: Azure/pipelines#v1
with:
azure-devops-project-url: 'https://dev.azure.com/some_org/some_project'
azure-pipeline-name: 'Name_Of_Release_Pipeline'
azure-devops-token: '${{ secrets.ADOPAT }}'
So the issue is that the Release Pipeline will not retrieve nor download the associated build artifact from GitHub. I can see that the GitHub workflow build information is stored in various Environment Variables, so the Release Pipeline is retrieving various metadata from the GitHub build, but why won't it download?
FYI - There is a ADO task that does download GitHub "release" artifacts but the GitHub repo I am building has not yet created a "release" and thus there are no artifacts to download. So that doesn't help.
You can try to install the Azure DevOps extension "GitHub Actions" to your Azure DevOps organization where the release pipeline is in.
This extension contains two build/release tasks:
Run a GitHub Workflow
Download GitHub Workflow Artifacts
For your case, you can try to use the Download GitHub Workflow Artifacts task in your release pipeline to download the artifacts from the latest run of the specified GitHub workflow.

When I connect a Github repo in azure devops pipeline, does it pull the latest code from git every time a build is triggered in azure pipeline?

When I connect a Github repo in azure devops pipeline, does it pull the latest code from git every time a build is triggered?
As I want the pipeline to fetch the latest code from git every time the build is triggered

GitHub checks change the repo it builds on in Azure DevOps

Apparently someone was using another repo in Azure DevOps to build a repo in GitHub.
He no longer works here and I have to change this. I do a Pull Request and it builds on another repo. But it does build in the correct repo once I merge the code to master.
The reason I need to change it is that it looks like its building from a YAML that is old and not sure which one.
How do I change where GitHub checks build for a PR? Is it only by removing the build in that other repo?
You could find required Azure DevOps pipeline in GitHub - Repo -Settings - Branches-Branches protection rule - Require status checks to pass before merging
According to the pipeline name, you could find corresponding YAML file in Azure DevOps Project - Repo. Check if this pipeline locates at the wrong repo of Azure DevOps side.
You could directly change the right pipelines if they are listed in GitHub side. Otherwise, you may have to reconfigure GitHub-Azure DevOps Service connection through Azure Pipeline extension.

Publish a build artifect to a remote Git Repo - Azure DevOps

I have a build pipeline and I would like to publish the build artifect to a remote location which is a folder in an external Git repo. I have been able to create a "Azure Repos/Team Foundation" Server service connection to point to the external Azure DevOps. how do I consume that service connection through my build pipeline tasks? I could also use a release pipeline and copy the package over to a remote Git repo as well. How can I achieve this ?
I found the solution for this by using this extension - you can use it to point to a
TFVC repo
Git repo
Build pipeline
Release pipeline
TFS Artifects for Release Management