【发布时间】:2022-01-20 10:30:39
【问题描述】:
我正在尝试在 Azure 上的现有函数中部署新代码,但由于某种原因,我得到了一个 Green/Pass 管道,但是当我请求 URL 时,我得到了错误 404。
我做了什么:
-
手动设置函数
-
使用阶段运行管道:
a) mvn 包
b) 目标中 azure 函数的 zip 内容
c) 将工件从代理部署到管道
d) 使用 microsoft 的代码片段将工件部署到函数中。
管道进入绿色状态,功能已部署:
Starting: AzureFunctionApp
==============================================================================
Task : Azure Functions
Description : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
Version : 1.195.0
Author : Microsoft Corporation
Help : https://aka.ms/azurefunctiontroubleshooting
==============================================================================
Got service connection details for Azure App Service:'test'
Trying to update App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"https://teststorage.blob.core.windows.net/azure-pipelines-deploy/package_1639741028399.zip?***"}
Updated App Service Application settings.
Updated WEBSITE_RUN_FROM_PACKAGE Application setting to https://teststorage.blob.core.windows.net/azure-pipelines-deploy/package_1639743928399.zip?***
Syncing triggers for function app
Sync triggers for function app completed successfully
Successfully added release annotation to the Application Insight :test
App Service Application URL: http://test.azurewebsites.net
Finishing: AzureFunctionApp
但是当我请求 URL 失败时,我还检查了门户中的功能部分,并且那里的功能(手动部署)被删除了。
注意: 代码很好,因为我可以手动部署相同的代码并且它工作正常,通过管道不起作用。
管道代码:
pool:
vmImage: ubuntu-latest
variables:
serviceName: test
jdkVersion: "1.11"
stages:
- stage:
displayName: Build
jobs:
- job: "Deployment_draft"
steps:
- task: MavenAuthenticate@0
displayName: "Maven Authenticate"
inputs:
artifactsFeeds: test-artifactory
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/${{ variables.serviceName }}/target/azure-functions/${{ variables.serviceName }}
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '${{ variables.serviceName }}'
publishLocation: 'Container'
- task: AzureFunctionApp@1
inputs:
azureSubscription: 'SubscriptionTest(Subscription ID)'
appType: 'functionAppLinux'
appName: 'test'
deploymentMethod: zipDeploy
package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
【问题讨论】:
-
嗨 user3658886;我不太清楚你的情况。当您说“手动设置功能”时,您的意思是您只部署了裸露的function app?或者您正在部署一个函数应用以及一个或多个现有函数,然后再运行管道?
-
我的意思是,转到门户并在那里手动创建函数,而不使用任何管道或脚本。我的问题是当我尝试使用管道更新现有函数时
标签: azure azure-devops deployment azure-functions devops