Reputation: 1213
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.
Upvotes: 0
Views: 784
Reputation: 1000
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)
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
npm install
within $(Build.BinariesDirectory)\app_data\jobs\continuous\[webjobname]
(working folder)
Archive task $(Build.BinariesDirectory)
$(Build.ArtifactStagingDirectory)
(path to publish)Release definition: classic App Service Deploy using artifact zip file generated by above build
Upvotes: 1
Reputation: 38096
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:
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.
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.
More details for node.js app CI build, you can refer define your CI build for node.js app.
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.
Upvotes: 0