-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCM_DO_BUILD_DURING_DEPLOYMENT is set to False leading new packages define in requirement.txt are not getting loaded #61
Comments
is it linux consumption app? |
Yes,it is. |
Hi @ma185360,
|
@Hazhzeng I have that step in my workflow. And In the O/p I can see package got installed(CFFI). Here is the output of that step: Output: But in my Azure function I keep getting Module Not found error. But if I publish the function from VS code it works perfectly. Error: |
I also have an objection to this functionality. We recently setup Github actions to deploy our function app, which deploys successfully, and the new code is on the container - however it seems like old versions of the code are still being used and none of feature updates are available. We tried deploying manually, as we've been doing for months, and now the same thing happens with that deployment - successful deploy but no visible updates. Now we are searching for a fix to BOTH our pipeline and manual deployment while avoiding recreating the Function App all together. It took a long time to even discover these settings were being changed. Maybe if it were mentioned in the docs that these settings will be changed that would save people some time. Additionally, I don't think using a Github Action should have such dramatic effects on the function app settings, causing issues in our other operations. I would honestly prefer a Github Action that just runs remote build, much faster in our case and what we've been doing for a while. We're on Linux EP2 plan, Python 3.6 function app. Do we need to use the WEBSITES_RUN_FROM_PACKAGE feature to resolve this? Are there any recommendations to change the settings on our KUDU container itself? |
Changing ENABLE_ORYX_BUILD and SCM_DO_BUILD_DURING_DEPLOYMENT via the Github Action change the settings within our KUDU container, but not on the Azure Portal. Changing the settings from Azure portal had no effect on the KUDU container app settings (api/settings). For anyone trying to revert their ENABLE_ORYX_BUILD and SCM_DO_BUILD_DURING_DEPLOYMENT on the KUDU container, you can use the API here to manually edit the values, or any other app setting values: https://github.com/projectkudu/kudu/wiki/REST-API#settings A simple POST request, authenticated using username and password from your app's publish profile should do the trick. However, I'm guessing these settings will change back to false on their own if you use the Github action again. |
Correct. I have tried this and can confirm it. |
@ma185360 were you ever able to get your function app deploying properly with the functions-action? Does your code/functionality actually update when you deploy, or is just your modules that are not updating? |
Yes, it worked properly in beginning until i added a new module in my requirements.txt and things went wrong after that. So it's modules which are not getting updated. |
Very interesting. In our case, the deployment is successful, and by viewing files in KUDU we can see python code and requirements.txt are in fact updated in the site root folder. When requesting the function though, we still get the results from old code. I think this has something to do with WEBSITES_RUN_FROM_PACKAGE. I believe this github action actually prefers that method (at least for Linux apps). You could try setting WEBSITES_RUN_FROM_PACKAGE to 1 (or true, I never know which one is right) in your app settings (on azure portal but also via the KUDU API just in case). Then you might see your changes reflected. I'm going to do the same. |
Is this issue still being faced ? |
Still facing the exact same issue with the following Workflow definition:
My
Querying the application fails with the following error:
Tried with different combinations of Deploying through VSCode Extension works flawlessly... Did someone of you have any luck deploying a Python Function in Azure through GitHub Actions with custom requirements? Thanks in advance for your help! |
Hey @tgdfool2 I had to use this API to change the ORYX/SCM settings on our VM, changing the settings in Azure portal had no effect, see below. Keep in mind, the functions-action will automatically change these back whenever it deploys your app, so using this API will just change the settings back so you can deploy another way. We ended up creating a custom deploy github action. We installed the azure-functions-core-tools in the github action and then used the remote build from there.
|
Thanks for your answer @marcd123. Actually, I also tested the "manual" way by using the In the end, it turns out that the problem was not related to the deployment tool I used ( As reference, please find here my App Settings: With those settings, the Workflow described in my previous post is working like a charm. Hope this helps other people as well! |
@tgdfool2 Sorry for asking again. |
Hi @20shivangi, As mentioned in my previous answer, after having properly set the |
@ma185360 Are you still facing this issue ? |
Since there has been no response, we are closing this issue. Please feel free to reopen in case of any queries. |
From v1.3.1 one needs to put scm-do-build-during-deployment: true
enable-oryx-build: true As suggested in release notes, your workflow configuration will look like this: # Comment out 'Resolve Project Dependencies Using Pip' section as it is no longer needed.
# Python package resolution will be completely handled by remote build
# - name: 'Resolve Project Dependencies Using Pip'
# shell: bash
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt --target=".python_packages/lib/site-packages"
#
# Set scm-do-build-during-deployment and enable-oryx-build to 'true' in GitHub Action
# to ensure remote build is enabled for this deployment
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@dev
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '.'
publish-profile: ${{ secrets.LINUX_PYTHON_DED_ENABLE_RB }}
scm-do-build-during-deployment: true
enable-oryx-build: true |
Hi Team,
We found that if we are doing Kudo zip deployment and want to upload new module then we need to set both SCM_DO_BUILD_DURING_DEPLOYMENT and ENABLE_ORYX_BUILD are set to true.
https://docs.microsoft.com/en-us/azure/azure-functions/recover-python-functions?tabs=manual#mitigate-modulenotfounderror
Now, when we do deployments via Github actions it sets both the variables to false automatically and there is no way we can change this behavior.
Logs:
Run Azure/functions-action@v1
with:
app-name: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
package: .
publish-profile: ***
respect-pom-xml: false
respect-funcignore: false
env:
AZURE_FUNCTIONAPP_NAME: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AZURE_FUNCTIONAPP_PACKAGE_PATH: .
PYTHON_VERSION: 3.6
pythonLocation: /opt/hostedtoolcache/Python/3.6.12/x64
Successfully passed SCM crednetial from new publishProfile
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Sucessfully acquired app settings from function app (SCM)!
Will archive . into /home/runner/work/_temp/temp_web_package_48933186187879785.zip as function app content
Will use api/zipdeploy to deploy (scm credential)
Setting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to false
Update using Client.updateAppSettingViaKudu
Response with status code 204
App setting SCM_DO_BUILD_DURING_DEPLOYMENT propagated to Kudu container
Setting ENABLE_ORYX_BUILD in Kudu container to false
Update using Client.updateAppSettingViaKudu
Response with status code 204
App setting ENABLE_ORYX_BUILD propagated to Kudu container
Package deployment using ZIP Deploy initiated.
The text was updated successfully, but these errors were encountered: