Open paulschroeder-tomtom opened 1 year ago
This issue is idle because it has been open for 14 days with no activity.
Bump...
This issue is idle because it has been open for 14 days with no activity.
@paulschroeder-tomtom Hi, I just made a workflow deploying a python flask app as an azure function, using poetry. Here is an excerpt, hope it helps!
env:
AZURE_FUNCTIONAPP_NAME: 'my_name' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
PYTHON_VERSION: '3.8' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')
POETRY_VERSION: '1.7.1' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: Setup Python ${{ inputs.PYTHON_VERSION }} Environment
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.PYTHON_VERSION }}
- name: 'Set up poetry'
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ inputs.POETRY_VERSION }}
- name: 'Resolve Project Dependencies Using Poetry'
shell: bash
run: |
pushd './${{ inputs.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
poetry export --format requirements.txt --output requirements.txt
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
- name: Log into Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ inputs.AZURE_FUNCTIONAPP_NAME }}
package: ${{ inputs.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
scm-do-build-during-deployment: false
enable-oryx-build: false
respect-funcignore: true
This issue is idle because it has been open for 14 days with no activity.
@GodVenn thank! But since MS was not helpful in that regard (honestly and sadly no surprise :disappointed:) we settled on the following workaround:
jobs:
func:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit_sha }}
- name: Install dependencies and login to Azure CLI
uses: ./.github/actions/prepare-runner
with:
azure-tenant-id: ${{ vars.AZURE_TENANT_ID }}
azure-subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
azure-client-id: ${{ vars.AZURE_CLIENT_ID }}
# interesting stuff starts here:
- name: Install poetry
uses: abatilo/actions-poetry@v2
# optionally select a version:
# with:
# poetry-version: # default=latest
- name: Make Oryx happy with requirements.txt
working-directory: ${{ inputs.function_directory }}
run: |
poetry export --without=test --without-hashes --format=requirements.txt > requirements.txt
- name: Upload Function
uses: Azure/functions-action@v1
with:
app-name: ${{ inputs.function_app_name }}
package: ${{ inputs.function_directory }}
scm-do-build-during-deployment: true
enable-oryx-build: true
I seems like the Oryx builder which the Azure/functions-action@v1
is using does the pip install itself. I complains if its not finding a requirements.txt
, which gets fixed by exporting with poetry. Feel free to mix and match our solutions.
@paulschroeder-tomtom Yeah, that's essentially the same workaround we have!
Very strange because App Services, which also uses Oryx, works correctly with poetry
I'm running into the same issue when deploying from VS Code.
We use poetry to manage our dependencies. When we use in our workflows like that:
we encounter the following error:
I also found this two issue:
PRE_BUILD_COMMAND
env.var. did not work.Full log: