Define a continuous integration build for your Node.js app
VSTS | TFS 2017 RTM
Here we'll show you how to define a continuous integration (CI) build process for your Node.js app. If you want to also continuously deploy (CD) your app to Azure, you'll be set up to make that happen after you're done creating this CI build process.
Upload your code
Do you have your own code?
No: Upload the sample app to Visual Studio Team Services (VSTS) or your on-premises Team Foundation Server. Either push your code to Git or check in your code to TFVC.
Copy the gulpfile.js and web.config files from the sample app to the root folder of your app.
Upload your code to VSTS or your on-premises Team Foundation Server: either push your code to Git or check in your code to TFVC.
Define your CI build
(If you don't see your team project listed on the home page, select Browse.)
- On-premises TFS:
- On-premises TFS:
- Click Empty to start with an empty definition.
Add the build tasks
On the Tasks or Build tab, add these tasks.
Package: npm install
Install your npm package dependencies.
Pack your files into a .zip file.
Make sure you've got a copy of gulpfile.js from our sample app in the root folder of your app.
Package: npm test
(Optional) Test your application.
Build: Publish Build Artifacts
(Optional) Drop some of the build outputs, such as the .zip file as we do in the example below.
Enable continuous integration (CI)
On the Triggers tab, enable Continuous integration (CI). This tells the system to queue a build whenever someone on your team commits or checks in new code.
Save, queue, and test the build
Save and queue the build. Once the build is done, click the link to the completed build (for example, Build 1634), click Artifacts, and then click Explore to see the .zip file produced by the build. This is the web deploy package that your release definition will consume to deploy your app.
Continuously deploy (CD) your app
After you've run the CI build, you're ready to create a continuous deployment (CD) release definition so that you can deploy your app to:
What code is in the sample app?
Our Node.js Hello World sample app contains:
|-- .gitignore `-- helloworld |-- gulpfile.js |-- package.json |-- server.js |-- web.config `-- typings
The gulpfile.js script zips up the app so it can be deployed to Azure. The web.config file enables running the app on Azure. The .gitignore file keeps build artifacts on your dev machine from getting into your Git repo.