0

I am familiar with how to set up continuous integration of node.js web applications using VSTS.

How do I go about setting up continuous integration for a node.js webjob. I have found examples of how to do it with a .NET project using Visual Studio however could not find any documentation on how to do it with a node.js webjob.

2 Answers 2

1

done the following : a build + deploying a nodejs webjob through Azure App Service Deploy task (FTP was stopped due to security issue in our IT landscape).

it's a quick & dirty approach for recovering our build + release process which were at stake, open minded to any other approach, but documentation on this specific topic (as said in the initial question) is fairly inexistant.

in my project, all stuff (run.js + package.json + dependencies are at root level)

Build definition enter image description here

  1. Get Sources
  2. powershell script inline (cleanup destination folder, create destination folder, move root folder to webjob structure)
Remove-Item -Path $(Build.BinariesDirectory)\app_data -Force -Confirm:$false -Recurse -ErrorAction:Ignore
New-Item $(Build.BinariesDirectory)\app_data\jobs\continuous\ -ItemType Directory -Force
Move-Item $(Build.SourcesDirectory)\[webjobname]\ $(Build.BinariesDirectory)\app_data\jobs\continuous\[webjobname] -Force
  1. npm install within $(Build.BinariesDirectory)\app_data\jobs\continuous\[webjobname] (working folder)

  2. Archive task $(Build.BinariesDirectory)

  3. Publish artifact $(Build.ArtifactStagingDirectory) (path to publish)

Release definition: classic App Service Deploy using artifact zip file generated by above build

Sign up to request clarification or add additional context in comments.

Comments

0

To CI build your node.js app, you can manage your code by a repo on VSTS firstly (or remote repo hosted on other sites such as github, bitbucket ect), then create a build definition definition for your node.js webjob. Detail steps as below:

1. Manage code by VSTS repo (git or TFVC)

You can manage your node.js app to a current repo you used or you can create a new repo to manage your node.js app. Create a new git repo (I use git repo as example, similar with TFVC), you can refer create a git repo for team project.

Push your node.js code to VSTS repo. You can use VS (clone the repo -> copy your code in local repo -> commit -> push) or git commands directly.

2. Create CI build

In Builds Tab -> New -> use the Node.JS With Gulp (PREVIEW) template (or you can use empty template and then add tasks manually) -> Get sources step -> specify repo and branch which your code exists -> specify settings for tasks -> add other tasks if you need -> Triggers Tab -> enable Continuous Integration. enter image description here

More details for node.js app CI build, you can refer define your CI build for node.js app.

3. Add your app in Azure webjobs

In the CI build definition, add below tasks:

  • Copy files task: to copy the App you want to run on Azure webjobs from $(System.DefaultWorkingDirectory) to $(Build.ArtifactStagingDirectory).

  • Archive Files task: create a zip file (such as $(Build.ArtifactStagingDirectory)/webjob.zip) from files in $(Build.ArtifactStagingDirectory).

  • Azure App Service Deploy task: deploy your zip file ($(Build.ArtifactStagingDirectory)/webjob.zip) to Azure.

And more details, you can also refer this thread.

7 Comments

As mentioned in my question, I know how to publish a Node.js web application using VSTS CI. I would like to know how to do it specifically for Node.js WebJobs.
Do you mean running node.js app in Azure webjobs with CI build?
I would like to deploy an Azure WebJob using VSTS CI. So I have the code for the WebJob and I can deploy it manually by zipping the code and deploying it through the Azure Portal under WebJobs in my Web App. I would like to automate that step.
Ok, I added the step to deploy your app to Azure webjobs in my answer.
@MarinaLiu-MSFT does the webjob.zip needs a specific structure for matching the continuous jobs one ? documentation is fully oriented C# (including a nuget). since 2 years we were doing ftp copy, but some new security rules stopped that :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.