I have code in two github repositories that I would like to build and run in the same build pipeline.
Does anybody know if it's possible to clone/pull more than one repo during the 'get sources' step?
In Azure DevOps, a pipeline is only associated with a single repository, by default. However, there are options to include code from other Git repositories in to the build:
Add Command Line task and execute git clone with a PAT in the pipeline
Add the 2nd repository as a submodule to your primary repository. Make sure to check the 'checkout submodules' checkbox under 'Get sources' in the classic editor.
Build each repository separately and use a RELEASE pipeline to bring them together as below:
From the left menu, choose "Releases" under the "Pipeline" group. (as of 14th Oct 2019).
You will be able to add multiple artifacts to the pipeline by clicking on '+ Add'.
The screenshot below shows 3 different sources. A docker image in Azure Container Registry, A build that has output artifacts & a GitHub repository.
All the artifacts get copied to the build agent at run time in their own folders:
Related
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
The YAML that defines the Azure Pipeline is defined in an Azure Repository.
The actual app code is contained in a GitHub repository (on which the commits referencing work items are made).
The pipeline is configured to link work items automatically according to the documentation, using * to select all branches.
The Pipeline adds the Github Repository as a resource repositories, checks it out correctly, detects the work item AB#XXX based on Git commit messages, and show the linked work items in the Run summary:
However, when opening the listed work item, we don't have any Build link, only the Git-related links:
I would expect an "Integrated in Build" linke the following to have been added:
The "Integrated in Build" link is not supported in your scenario. It only applies with Azure Repo branch.
To prove this, for Azure pipeline directly using GitHub Repo, "Automatically link work item included in this run" is not shown.
I have imported a repository from BitBucket to GitHub. How can I point the existing pipeline in Azure Pipelines to the new repository location? The UI has failed me so far.
Simplest way is to create a new pipeline, link it to the github repo and point it to the existing yaml file.
But there is a way to retarget the existing pipeline.
Edit the pipeline
In the upper right corner open the ... menu
Pick the ⚡ Triggers option
Click the YAML tab
Click the Get Sources option
Reconfigure the source repo
I am looking for hosting .exe files in Azure Devops. It seems to don't have feature similar to how we host executable or build files in GitHub for other people to download. Do we have such kind of feature to host the executables and have the latest commit tagged?
You can try publishing the executable or build files as Build Artifacts in Azure devops build pipeline.
You can create a pipeline in azure devops and using Publish build artifacts task to store the executable or build files in azure pipeline
See example here to create a classic azure pipeline. See Here for yaml pipeline example.
When you run the pipeline. You will see the commit hash and the files uploaded in the highlighted field of the build summary page shown in below screenshot. And you download the files from there.
You can retain this artifacts by Clicking retain in the pipeline run. See below
You can also change the retention policy for your pipeline. See here for more information.
Go the Project settings page-->Settings under Pipeline. See below:
I have python solution which resides in VSTS repository. Using build pipeline and private agent, the source code gets copied to VM.
After executing the python files, output is stored in 3 different files at the source directory level.
I want to download/copy these output files from private hosted VM to VSTS repository.
How can this be achieved?
Thank you
The only way to get something into the repository is by checking it in via source control.
Maybe it's enough for you to just publish these files as a build artifact. You have the option to publish directly to VSTS or to any Windows file share.
If you really want these files in your repository I'd suggest you publish them as build artifacts and check them in with a release pipeline. You could add a new stage in your existing release pipeline or add a new release pipeline that triggers automatically every time your build completes.
You can call git command to add and push changes to repository, for example:
Check Allow Scripts to access the OAuth token option
Add Command Line task (Tool:git; Arguments: add [file path]; Working folder: $(System.DefaultWorkingDirectory))
Add command line task (Tool:git; Arguments: commit –m “add build result”; Working folder: $(System.DefaultWorkingDirectory))
Add command line task (Tool: git; Arguments: push https://test:$(System.AccessToken)#{account}.visualstudio.com/{project}/_git/{repository} HEAD:master
Related article: Keep Git repository in sync between VSTS / TFS and Git
On the other hand, the better way is publishing the result files as artifact of build through Publish Build Artifact task.