問題描述
在 Azure Devops 的 mono repo 中設置項目的工作目錄 (Set working directory of a project in mono repo in Azure Devops)
我的項目正在使用微服務,在一個存儲庫中,我們在 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 中為不同項目設置工作目錄?
更新:
我能夠找到該文件,但構建沒有給我任何輸出文件。 我能夠找到該文件,但構建沒有給我任何輸出文件。參考解法
方法 1:
How I fixed this issue: Initially I was not sure if the working directory was set properly.Even if it was , I was not sure whether the package.json file was read properly. To check that, I added the below script to the Azure CI pipeline, for example:
inputs:
targetType: 'inline'
script: dir
$(Build.ArtifactStagingDirectory)
displayName: 'Check'
This showed me that after building , the artifacts are not stored anywhere. hence I had to explicitly mention the outputpath. For that I ran the below command for build:
run‑script build ‑‑ ‑‑output‑path=$(Build.ArtifactStagingDirectory
This fixed the issue I was facing.