简体   繁体   English

Azure DevOps Build Pipeline 有两个仓库,不同的文件夹

[英]Azure DevOps Build Pipeline with two repos, different folders

We're in the process of migrating some old projects and as initial step I have put our first project into a git repo.我们正在迁移一些旧项目,作为第一步,我将我们的第一个项目放入 git 存储库中。 As an interim measure, we've also added the bin, packages and references folder to separate repo.作为一项临时措施,我们还将 bin、packages 和 references 文件夹添加到单独的存储库中。

However the code won't build with the files in the bin folder etc, I need to be one folder up.但是代码不会与 bin 文件夹等中的文件一起构建,我需要一个文件夹。

Locally we'd run a restore.ps1 script which will copy the bin folder etc into the main project.在本地,我们将运行一个 restore.ps1 脚本,它将 bin 文件夹等复制到主项目中。

So if we clone our binaries project in c:\binaries the project1 folder is created.因此,如果我们在 c:\binaries 中克隆我们的二进制项目,就会创建 project1 文件夹。 Inside that repo we have the follow structure.在该仓库中,我们有以下结构。

c:\git\binaries\project1\bin\
c:\git\binaries\project1\packages\
c:\git\binaries\project1\references\
c:\git\binaries\project1\restore.ps1

In our code repo we clone the repo into the c:\git folder we get the project1 folder.在我们的代码仓库中,我们将仓库克隆到 c:\git 文件夹中,我们得到 project1 文件夹。

c:\git\project1\project1\project1.sln
c:\git\project1\project1\project1\bin\
c:\git\project1\project1\references\
c:\git\project1\project1\packages\

I've ran the simple generate pipeline in Azure Devops and it's created the following...我在 Azure Devops 中运行了简单的生成管道,它创建了以下内容......

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

However, this is one folder too deep.但是,这是一个太深的文件夹。

I've been looking at commands to pull in the binaries repo and run the restore.ps1.我一直在查看用于拉入二进制存储库并运行 restore.ps1 的命令。 But this won't work as I need to up one level.但这不起作用,因为我需要提升一个级别。

- checkout: git://Binaries/project1@master

- task: PowerShell@2
  inputs:
    targetType: 'filePath'
    filePath: $(System.DefaultWorkingDirectory)\test2.ps1

I know you can set working directories, but I think the whole build process is hindged around the location of the yml file etc.我知道你可以设置工作目录,但我认为整个构建过程都围绕着 yml 文件的位置等。

Yaml pipeline supports checking out multiple repos . Yaml 管道支持检出多个 repos So you can check out both two repos in same pipeline:因此,您可以在同一管道中查看两个存储库:

resources:
  repositories:
  - repository: MyGitHubRepo # The name used to reference this repository in the checkout step
    type: github   #For github git repo
    endpoint: xxx
    name: MyGitHubOrgOrUser/MyGitHubRepo
  - repository: MyAzureReposGitRepo
    endpoint: xxx
    type: git   #For azure devops git repo
    name: MyAzureReposGitRepo

trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- checkout: self         #check out the main repo
- checkout: MyGitHubRepo #check out the code repo

Then you can use a CMD task with xcopy command or Copy Files task to copy the binary repo into main project folder.然后,您可以使用带有 xcopy 命令或复制文件任务CMD 任务将二进制 repo 复制到主项目文件夹中。 You even don't need to use the restore1.ps file.您甚至不需要使用 restore1.ps 文件。

And the path of the two repos, see check out path .以及两个 repos 的路径,请参见check out path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure devops:在不同存储库的分支上构建管道触发器 CI - Azure devops: Pipeline Trigger CI build on branch in different repositories 将本地文件夹映射到 Visual Studio 中的 Azure DevOps Git 存储库 - Mapping local folders to Azure DevOps Git Repos in Visual Studio azure devops 存储库 URL - azure devops repos URL 从 Azure DevOps Pipeline 提交到 Git Repo 时文件夹重复 - Duplication of folders when committing to Git Repo from Azure DevOps Pipeline 在 Azure Devops 中的现有存储库中导入另一个存储库 - Importing an another Repos in an existing Repos in Azure Devops Azure DevOps生成管道无法使用标记和路径筛选器进行生成 - Azure DevOps Build Pipeline cannot build with Tag and Path Filter Azure Devops 构建管道 - 单击一次应用程序发布版本控制策略 - Azure Devops Build Pipeline - Click Once Application Release Versioning Strategy 如何根据提交消息触发 azure devops build pipeline? - How to trigger azure devops build pipeline based on the commit message? 从构建管道推送到本地 Azure DevOps Git - Push to local Azure DevOps Git from Build Pipeline Azure DevOps 构建和发布管道与 GitFlow 分支 - Azure DevOps Build and Release-Pipeline with GitFlow Branching
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM