上下文:我有一个部署Azure函数的GitHub Action。每次有人推到'dev'分支时,它都会崩溃。唯一的手动“变通办法”我发现的工作是以下;
1.前往Azure的Function App > Configuration > Application Settings
1.删除WEBSITE_RUN_FROM_PACKAGE=1配置
1.重新运行GitHub Actions上的所有作业(像这样成功)
1.再次添加WEBSITE_RUN_FROM_PACKAGE=1配置,否则我会陷入使用msal(NodeJS)的登录循环中
请注意,我有两个环境。一个是“dev”,另一个是“prod”。
GitHub操作失败作业描述:
Run Azure/functions-action@v1.3.2
with:
app-name: myapi
package: ./functionsApi
publish-profile: ***
slot-name: dev
scm-do-build-during-deployment: true
enable-oryx-build: false
respect-pom-xml: false
respect-funcignore: false
env:
AZURE_FUNCTIONAPP_NAME: myapi
AZURE_FUNCTIONAPP_SLOT: dev
AZURE_FUNCTIONAPP_PACKAGE_PATH: ./functionsApi
AZURE_FUNCTIONAPP_PUBLISH_PROFILE: ***
NODE_VERSION: 16.x
Successfully parsed SCM credential from old publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Sucessfully acquired app settings from function app (with SCM credential)!
Will archive ./functionsApi into D:\a\_temp\temp_web_package_5053591759469989.zip as function app content
Will use Kudu https://<scmsite>/api/zipdeploy to deploy since publish-profile is detected.
Setting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to true
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.
Error: Failed to deploy web package to App Service.
Successfully updated deployment History at https://REMOVEDpi-dev.scm.azurewebsites.net/api/deployments/d3799f4XXX933eaa14f3663f3ebdfa67f9732d7b175b1690836786357
Error: Execution Exception (state: PublishContent) (step: Invocation)
Error: When request Azure resource at PublishContent, zipDeploy : Failed to use D:\a\_temp\temp_web_package_5053591759469989.zip as ZipDeploy content
Error: Failed to deploy web package to App Service.
Internal Server Error (CODE: 500)
Error: Error: Failed to deploy web package to App Service.
Internal Server Error (CODE: 500)
at Kudu.<anonymous> (D:\a\_actions\Azure\functions-action\v1.3.2\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:175:23)
at Generator.next (<anonymous>)
at fulfilled (D:\a\_actions\Azure\functions-action\v1.3.2\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Deployment Failed!
字符串
myapp/.github/workflow/dev.node.js-functionapp-on-azure.yml:
name: (DEV) Deploy Node.js project to Azure Function App
on:
push:
branches:
- dev
env:
AZURE_FUNCTIONAPP_NAME: myapp
AZURE_FUNCTIONAPP_SLOT: dev
AZURE_FUNCTIONAPP_PACKAGE_PATH: "./functionsApi"
AZURE_FUNCTIONAPP_PUBLISH_PROFILE: "${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_DEV }}"
NODE_VERSION: "16.x" # set this to the node version to use (supports 8.x, 10.x, 12.x)
jobs:
build-and-deploy:
runs-on: windows-latest
environment: dev
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@master
- name: "Log env variables"
run: |
echo "AZURE_FUNCTIONAPP_NAME: ${{ env.AZURE_FUNCTIONAPP_NAME }}"
echo "AZURE_FUNCTIONAPP_SLOT: ${{ env.AZURE_FUNCTIONAPP_SLOT }}"
echo "GITHUB_WORKSPACE: ${{ github.workspace }}"
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: "Resolve Project Dependencies Using Npm"
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install --force
npm run build --if-present
popd
- name: "Run Azure Functions Action"
uses: Azure/functions-action@v1.3.2
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ env.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
slot-name: ${{ env.AZURE_FUNCTIONAPP_SLOT }}
scm-do-build-during-deployment: true
enable-oryx-build: false
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples
型
x1c 0d1x的数据
1条答案
按热度按时间z2acfund1#
我尝试使用Github操作从Master分支然后从Dev分支部署Azure Function Http触发器,并且成功,在这两个分支中,请参阅下面:-
主分支:-
x1c 0d1x的数据
我的仓库:-
的
我的github动作流程:-
字符串
的
我的开发分支:-
的
x1c4d 1x的
我的github操作工作流程:-
型
型
型