Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

acr build with python sdk #26771

Open MatthiasCami8 opened 1 year ago

MatthiasCami8 commented 1 year ago

Related command az acr build

Is your feature request related to a problem? Please describe. Currently it's not possible (or I did not find an easy solution at least) to call the build image command within python code (with SDK). We want to do this for example in a running docker container.

Describe the solution you'd like A clean way of calling acr build with Python.

Describe alternatives you've considered

Additional context We have a container app that is responsible of creating new images (based on incoming arguments) and pushing them to acr. So it needs to call az acr build somehow. This could be done via a bash script, but then you would have to do things such as az login..., which I've already tried, but is either not straight forward or not very clean (you also need a subprocess to call the script). Preferably, we would just call the acr-build python function, with as arguments:

Thanks in advance!

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @luisdlp, @northtyphoon.

Issue Details
**Related command** `az acr build` **Is your feature request related to a problem? Please describe.** Currently it's not possible (or I did not find an easy solution at least) to call the build image command within python code (with SDK). We want to do this for example in a running docker container. **Describe the solution you'd like** A clean way of calling `acr build` with Python. **Describe alternatives you've considered** - I've tried using the `[acr_build](https://github.com/Azure/azure-cli/blob/6928cee824b2dcbc95b66976cf992a6c9d76ffe5/src/azure-cli/azure/cli/command_modules/acr/build.py#L25C54-L25C54)` python function that exists in the `azure-cli`. However, the first `cmd` argument is not documented, and I can't find what I should give as argument here (and if this is even a clean way of doing this). **Additional context** We have a container app that is responsible of creating new images (based on incoming arguments) and pushing them to acr. So it needs to call `az acr build` somehow. This could be done via a bash script, but then you would have to do things such as `az login...`, which I've already tried, but is either not straight forward or not very clean (you also need a subprocess to call the script). Preferably, we would just call the acr-build python function, with as arguments: - local Dockerfile - container-registry - image-name (and tag) Thanks in advance!
Author: MatthiasCami8
Assignees: -
Labels: `Service Attention`, `Container Registry`, `question`, `customer-reported`, `Auto-Assign`, `Azure CLI Team`
Milestone: Backlog
navba-MSFT commented 1 year ago

Adding Service team to look into this.

toddysm commented 1 year ago

Changing the assignment to @northtyphoon and @terencet-dev for next steps.

mkempers commented 3 months ago

@MatthiasCami8, did you find a workaround for this while waiting for this functionality in the Python SDK?

terencet-dev commented 3 weeks ago

Hi @MatthiasCami8 , apologies for the delay. Are you still experiencing this issue?