Azure / container-apps-deploy-pipelines-task

Azure Pipelines Task (Release Candidate) for building and deploying Azure Container Apps
MIT License
6 stars 10 forks source link

appSourcePath and dockerfilePath join not working #14

Closed valeriomarzulli closed 1 year ago

valeriomarzulli commented 1 year ago

Used version 0.1.7 and was able to correctly specify both path and dockerpath with a specific name ex yaml: appSourcePath: '$(Build.SourcesDirectory)' dockerfilePath: 'my-component.dockerfile' (my-component.dockerfile is in the root folder)

With version 0.1.9 instead: appSourcePath: '$(System.DefaultWorkingDirectory)' dockerfilePath: 'my-component.dockerfile' the result is: "A Dockerfile was provided or found for the application source; attempting to build the image from Dockerfile '/home/vsts/work/1/s/home/vsts/work/1/s/my-component.dockerfile'" it seems to merge the absolute path of the docker file with appSourcePath

So, to make it work i have to specify: appSourcePath: './' dockerfilePath: 'my-component.dockerfile'

The documentation is misleading. Should I use $(System.DefaultWorkingDirectory) (and therefore there is a bug) or should the documentation just be updated?

mateuszkozakiewicz commented 1 year ago

I think this is a bug, I imagine appSourcePath was meant to have a default value of $(System.DefaultWorkingDirectory) instead $(System.DefaultWorkingDirectory) is always appended to whatever you supply in appSourcePath If this was intended for whatever reason then it is a breaking change, it took me a few days to notice my apps are not being deployed because docker build exit code in this task is ignored, so is any non zero exit code from az containerapp up

valeriomarzulli commented 1 year ago

yeah i guess that, in this scenario, the bug concerns the fact that dockerfilePath should not include the root path. Documentation says: "dockerfilePath: Relative path (without file prefixes, see example below)...". So when joined to appSourcePath, the result has to be something like: /home/vsts/work/1/s/+ /path/to/dockerfile.

Now is: /home/vsts/work/1/s/+ /home/vsts/work/1/s/path/to/dockerfile

phcbarros commented 1 year ago

There are any alternative to make it works again? There are any chance to you add testing in your code?

cormacpayne commented 1 year ago

Hey folks, apologies for this issue -- let me investigate what's going on here and hopefully we'll have a fix out for this shortly.

cormacpayne commented 1 year ago

This is now fixed in the 0.1.10 release of the AzureContainerAppsRC task -- I verified the fix against a few scenarios in a test Azure Pipeline, but would love to confirm with folks in this thread that the issue is resolved before closing.

valeriomarzulli commented 1 year ago

hi! It's working now, i am able now to use

appSourcePath: '$(System.DefaultWorkingDirectory)'
dockerfilePath: 'my-component.dockerfile'

thanks for your effort!

cormacpayne commented 1 year ago

@valeriomarzulli Thank you for verifying! I'm going to close this issue -- please feel free to comment on and/or re-open this issue if this behavior persists.