使用Jenkins部署Azure函数

t8e9dugd  于 2023-08-03  发布在  Jenkins
关注(0)|答案(1)|浏览(151)

我使用以下命令创建了一个azure函数应用程序:

az functionapp create --resource-group <resource_name> --consumption-plan-location eastus --name <function_app_name> --storage-account <storage_account> --runtime python --runtime-version 3.7 --functions-version 3 --os-type Linux --deployment-local-git

字符串
我正在尝试使用以下管道脚本部署我的函数:

node {
   stage('Preparation') { // for display purposes
      // Get some code from a GitHub repository
      git branch: 'master',
      credentialsId:'4222f74d-44c5-4167-99b5-3a61b2d2d1f0',
      url: <github url>

   }
   stage('Publish') {
      azureFunctionAppPublish azureCredentialsId: 'e9ba5433-b5de-4732-ad17-8a517516827d',
                        resourceGroup: < resource_name >, appName: <function_app_name>,
                        filePath: '**/*.py,requirements.txt'

   }
}


但我得到了这个错误:

using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress -- https://<function_name>.scm.azurewebsites.net:443/<function_name>.git +refs/heads/*:refs/remotes/origin/* # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
hudson.plugins.git.GitException: Command "git fetch --tags --progress -- https://<function_name>.scm.azurewebsites.net:443/<function_name>.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: repository 'https://<function_name>.scm.azurewebsites.net:443/<function_name>.git/' not found

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:798)
    at com.microsoft.jenkins.function.commands.GitDeployCommand.execute(GitDeployCommand.java:84)
    at com.microsoft.jenkins.function.commands.GitDeployCommand.execute(GitDeployCommand.java:53)
    at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
    at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
    at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
    at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
    at com.microsoft.jenkins.function.FunctionAppDeploymentRecorder.perform(FunctionAppDeploymentRecorder.java:97)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Finished: FAILURE


似乎插件无法在Azure上对我的git本地存储库进行身份验证。
有什么建议吗

rbpvctlc

rbpvctlc1#

我能够重现您的问题,并且可以看到当前azureFunctionAppPublish插件不接受/验证Linux操作系统类型的Azure函数。如果有兴趣,我会建议你(对我有效的方式,即)尝试与Windows操作系统类型的Azure函数相同,它会工作。或者,作为解决方法,您可以安装Azure CLI / Azure PowerShell Jenkins插件,并根据需要尝试命令方式部署。
另一方面,我理解你可能想使用azureFunctionAppPublish插件,并且只想在Linux操作系统类型/ Python运行时下部署,那么在这种情况下,我建议在Jenkins JIRA中提出一个bug,正如这里提到的,这就是azureFunctionAppPublish插件的维护者如何记录或处理bug和功能请求的方式。

相关问题