【问题标题】:Azure Function Deploy with Jenkins使用 Jenkins 部署 Azure 函数
【发布时间】:2020-03-12 17:25:03
【问题描述】:

我使用以下命令创建了一个 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 本地存储库进行身份验证。

有什么建议吗?

【问题讨论】:

    标签: azure jenkins


    【解决方案1】:

    我能够重现您的问题,并且可以看到当前 azureFunctionAppPublish 插件不接受/验证 Linux 操作系统类型的 Azure Functions。如果有兴趣,我会建议您(即对我有用的方式)尝试使用 Windows 操作系统类型的 Azure 函数,它会起作用。或者作为一种解决方法,您可以安装 Azure CLI / Azure PowerShell Jenkins 插件并尝试适当的命令部署方式。

    另一方面,我知道您可能想使用azureFunctionAppPublish 插件并且只想在Linux OS 类型/python 运行时下部署,那么在这种情况下,我建议在Jenkins JIRA 中提出一个错误,如@ 987654324@ 这就是azureFunctionAppPublish 插件的维护者记录或处理错误和功能请求的方式。

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2017-08-30
      • 1970-01-01
      • 1970-01-01
      • 2021-05-28
      • 1970-01-01
      • 1970-01-01
      • 2019-08-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多