0
votes

I wasn´t able to find out much on internet about this. But I have a jenkins jobs that deploys a .net webapp using plugin azureWebAppPublish like follows. After the .net app is build in previous step in same pipeline I have following stage

stage ('publish to azure ') {


            azureWebAppPublish appName: "webapp-A",
                    azureCredentialsId: "jenkins-login",
                    publishType: "file",
                    filePath: "**/*.*",
                    resourceGroup: "webapp-rg"
                   
    }

I know that this by default deploys the files webapp in: home\site\wwwroot In fact When I access there over console in azure I see the files deplyed.

Everything ok so far, files are deployed successfully in webapp. But now I would like to publish also a webjob in same webapp.

I created it first by publishing it from visual studio. Right click, publish the wbjob and that´s it , the web job is running in azure in that webap. Thinig is that I would like to do it from the pipeline now. I saw that after I created the webjob, Inside home\site\wwwroot a folder was created, called: D:\home\site\wwwroot\app_data\Jobs\Continuous\service.webjobs(all files of that my webjob)
so there are all the files I would like to update.

but I don´t know how to do this same way using azureWebAppPublish as I used for webapp. indicating destination path for webjob files.

I used this and job run successfully

stage ('publish webjob ') {
    
    
                azureWebAppPublish appName: "webapp-A",
                        azureCredentialsId: "jenkins-login",
                        publishType: "file",
                        filePath: "**/*.*",
                        resourceGroup: "webapp-rg"
                        sourceDirectory: "/var/lib/jenkins/workspace/servicestest/Services.WebJob/"
                        targetDirectory: "app_data/Jobs/Continuous/webjobtest1"
        }

but no update in app_data/jobs/contiues/webjobtest1 was made in fact, the job run ok and the webapp was updated and no the webjob

How can I update webjobs using jenkins? has someone did this sometime?

I see this post but honestly it´s not quite clear how is it done.

1

1 Answers

0
votes

Going out on a limb but I looked at File Command for the Azure App Service plugin. Check for deployment log to see if it found your .zip in your source folder. That should at least show if where the zip file is being pick up. According to this doc

targetDirectory (optional) Target directory relative to the site root. Type: String

so your path may not be getting translated correctly. But to be honest, I'm not even sure how targetDirectory is being used by the plugin for file deployment.

If the logs don't reveal anything, I suggest using a CLI plugin that will allow your deploy your webjob through curl.