microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: AzureContainerApps@1 with multiple projects in repo fails to build or has no way to distinguish which one to build #19664

Open kiwiinlondon opened 7 months ago

kiwiinlondon commented 7 months ago

New issue checklist

Task name

AzureContainerApps@1

Task version

No response

Issue Description

Hi, I am hoping you can help.

I have 3 projects in my solution. 2 projects that contain .net core apis that I wish to push to ACA and a 3rd common project that are referenced by both. However, I cant work out the correct syntax to use build and deploy one of these apis to ACA. I have tried to set the 1-To set the appSourcePath to be the root of the solution but got the below error Error: Ambiguity in selecting a project to build. Found multiple projects 2-To set the appSourcePath to be the folder containing one of the projects I want to build as a container but got an error as the common .csproj could not be found Skipping project "/xxx.csproj" because it was not found error CS0234: The type or namespace name 'xxx' does not exist in the namespace 'xxxx' (are you missing an assembly reference?) 3-To set the dockerfilePath to be the folder containing the project that I wish to build into a container. However, not unexpectedly, I get an error that states that it is a directory and not a file. I am wanting to build without using a dockerfile and instead using a .net sdk build. 4-I tried adding a PROJECT environment variable so the right csproj was picked up but to no avail

Hopefully, I am just missing something and you can point me in the right direction. Otherwise could I request an enhancement that a new input be added that works like the dockerfilePath so that I can define which project is to be built if there are multiple

Any help greatly received

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

UBuntu

Relevant log output

Status: Downloaded newer image for mcr.microsoft.com/oryx/cli:builder-debian-buster-20230208.1
Error: Ambiguity in selecting a project to build. Found multiple projects: /app/xxxx.API/xxxx.csproj, /app/xxxx2.API/xxxx2.csproj.

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

trigger:
  branches:
    include:
      - main

pool:
  vmImage: ubuntu-latest

steps:
  - task: AzureContainerApps@1
    inputs:        
      appSourcePath: '$(System.DefaultWorkingDirectory)'
      azureSubscription: 'xxx-subscription-service-connection'
      acrName: 'xxxx'
      containerAppName: 'xxxx-api'
      resourceGroup: 'rfg-uks-xx-dev-xxxx'  
      imageToBuild: 'xxxx/xxxxapi:$(Build.BuildId)'
nor0x commented 3 months ago

any update on this issue? i have the same problem in a multi-project repository pushing to ACA

aherrick commented 2 months ago

i'm also seeing this. is it not possible to just target 1 project?