0

I'm trying to deploy a .NET web app as an app service in Azure using Jenkins and Azure app service plugin. Everything is working fine if I use a free style job and 'publish an azure app' as a post-build action, but I need to perform more complex tasks so I need to use pipeline. The pipeline is:

stage('checkout') {  
      git branch: 'develop', url: 'https://github.com/test.git', credentialsId: 'cred'
    }  
stage('build and publish') {  
     bat "dotnet publish test/test.sln -c Release "  
}
stage('deploy') {  
        azureWebAppPublish ([
            appName: "appName", 
            azureCredentialsId: params.azure_cred_id, 
            publishType: "file", 
            resourceGroup: "resName", 
            sourceDirectory: "test/test/bin/Release/netcoreapp3.1/publish/"
        ])

Also tried adding

    environment {
        git: 'C:\\Program Files\\Git\\cmd\\git.exe'
    }

The 'checkout' and 'build and publish' stages work fine, but on 'deploy' stage I get this error:

Starting Azure Web App Deployment
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "git" (in directory "c:\jenkins\workspace\test\.azure-deploy"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:252)
    at hudson.Proc$LocalProc.<init>(Proc.java:221)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
    at hudson.Launcher$ProcStarter.start(Launcher.java:508)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2443)
Caused: hudson.plugins.git.GitException: Error performing git command: git init c:\jenkins\workspace\test\.azure-deploy
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2457)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2380)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2376)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1923)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:995)

The main jenkins is running on linux, but this job is executed on windows node. The configuration is: Jenkins node configuration

C:\Program Files\Git\cmd is also added in the Environment variables on the VM

I guess I'm missing some additional configuration.

  • Looks like the windows machine does not have git installed in it – Saravanan Nov 20 '20 at 14:26
  • There is git installed on the windows node. The path is added in the environment variables also. It looks like the Azure app service plugin reads the environment variables from "Global Configuration Settings" in Jenkins instead of overriding them with the windows node configuration (the one on the screenshot). – Gergana G Nov 24 '20 at 15:26
  • are you sure that git.exe resides in the path you have mentioned, if not please verify if it is located in the AppData folder as like mentioned in this SO post https://stackoverflow.com/questions/11928561/where-is-git-exe-located#:~:text=The%20default%20path%20on%20windows,git.exe%20on%20all%20systems. – Saravanan Nov 27 '20 at 06:52

0 Answers0