2
votes

I am trying to publish our webapp to Azure using a Jenkins pipeline and the Azure Webapp Deployment plugin. I cannot get it to work. Weird thing is that I don't even get a decent error message. My Jenkinsfile contains following

stage("Publish to Azure") {
    steps {
        azureWebAppPublish ([
            appName: "xxx", 
            azureCredentialsId: "xxx", 
            publishType: "file", 
            resourceGroup: "xxx", 
            sourceDirectory: "docs/export"
        ])
    }
}

Starting Azure Web App Deployment

Cloning repository xxx.git

C:\Program Files\Git\bin\git.exe init D:\Jenkins\workspace\xxx # timeout=10

Fetching upstream changes from xxx

C:\Program Files\Git\bin\git.exe --version # timeout=10

using GIT_ASKPASS to set credentials

C:\Program Files\Git\bin\git.exe fetch --tags --progress xxx.git +refs/heads/:refs/remotes/origin/

C:\Program Files\Git\bin\git.exe config remote.origin.url xxx.git # timeout=10

C:\Program Files\Git\bin\git.exe config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10

Seen branch in repository origin/master

Seen 1 remote branch

C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10

C:\Program Files\Git\bin\git.exe checkout -f master

And then the pipeline fails, without a clear error ... Any ideas?

EDIT: When I open the job itself it shows the following:

java.lang.NullPointerException
    at hudson.FilePath.isAbsolute(FilePath.java:304)
    at hudson.FilePath.glob(FilePath.java:1807)
    at hudson.FilePath.access$1900(FilePath.java:208)
    at hudson.FilePath$31.invoke(FilePath.java:1788)
    at hudson.FilePath$31.invoke(FilePath.java:1785)
    at hudson.FilePath.act(FilePath.java:1020)
    at hudson.FilePath.act(FilePath.java:998)
    at hudson.FilePath.list(FilePath.java:1785)
    at hudson.FilePath.list(FilePath.java:1769)
    at hudson.FilePath.list(FilePath.java:1754)
    at com.microsoft.jenkins.appservice.commands.GitDeployCommand.copyAndAddFiles(GitDeployCommand.java:267)
    at com.microsoft.jenkins.appservice.commands.GitDeployCommand.execute(GitDeployCommand.java:100)
    at com.microsoft.jenkins.appservice.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.appservice.WebAppDeploymentRecorder.perform(WebAppDeploymentRecorder.java:203)
    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$1$1.call(SynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:290)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Thanks in advance! Regards

1

1 Answers

1
votes

I found the problem. filePath is a mandatory field. Fixed using:

        stage("Publish to Azure") {
            steps {
                azureWebAppPublish appName: "xxx",
                    azureCredentialsId: "xxx",
                    publishType: "file",
                    filePath: "**/*.*",
                    resourceGroup: "xxx",
                    sourceDirectory: "xxx"
            }
        }

The exception has been fixed as you can see here