问题描述
我的项目使用微服务,在一个存储库中,我们在 Azure DevOps 中有多个应用程序。 例如,我们有名为 Microservice 的 Repos,其中有 .NetProject、AngularUI 项目和 Java 项目代码。结构如下所示:
在设置 CI 管道时,我包含了如下路径:
variables:
- name: working-dir
value: 'MicroserviceProject/AngularUI/ClientApp/'
trigger:
branches:
include:
- master
paths:
include:
- 'MicroserviceProject/AngularUI/ClientApp/*'
我没有看到 AngularUI 项目的代码被正确检出并遇到错误,他们找不到 package.json 文件。 如何为 repo 中的不同项目设置工作目录?
更新:
解决方法
我是如何解决这个问题的: 最初我不确定工作目录是否设置正确。即使是,我也不确定 package.json 文件是否被正确读取。为了检查这一点,我将以下脚本添加到 Azure CI 管道中,例如:
inputs:
targetType: 'inline'
script: dir
$(Build.ArtifactStagingDirectory)
显示名称:'检查'
这向我展示了构建后,工件不会存储在任何地方。因此我不得不明确提到输出路径。为此,我运行了以下命令进行构建:
run-script build -- --output-path=$(Build.ArtifactStagingDirectory
这解决了我面临的问题。