Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The goal of this document is to help folks who want to contribute to the Azure Functions host (aka azure-webjobs-sdk-script).
🚧 This document is still a WIP 🚧
- The host is currently going through a redesign for v2 which moves it onto .NET core and move languages out into their own separate repos. These guidelines are generally written for the work going on in
devwhich is v2. The
masterbranch and a few others are still
v1and have a different workflow.
- The host has some dependencies on having some Azure resources provisioned, so before you get started, make sure you have reliable access to an Azure subscription. E2E tests require a lot of various services to be provisioned. If you're making large contributions which would affect E2E tests, it'll be expected that you can provision those services yourself.
- Be nice :) Everyone is busy and sometimes it can take a bit to get responses on things. Just be patient and, if you do poke someone for help, please be courteous and respectful.
- Windows 10 (suggested)
- Mac OS X/Linux (not-recommended for now)
- While you can develop from a Mac/Linux machine, it can be a rough experience and not all unit tests pass today. We have improvements where we hope to make this easier.
- Language runtimes
- Note: today you have to have Node.js and Java installed, but in the long run we hope move those tests out into their own repos
- Java 8 (JDK and JRE required)
- Node 8.4+
- .NET Core 2.0
- Visual Studio 2017 (recommended)
- VS Code (works, but has some quirks running tests)
- Misc tools (suggested)
- git - source control
- nvm (nvm-windows for windows) - Node Version Manager (for managing multiple versions of Node.js)
- Commander/ConEmu(Windows)/iTerm(mac) - console managers; makes dealing with lots of consoles more manageable
functions core tools - helps for making samples/etc.
npm i -g azure-functions-core-tools@core
Running locally (Visual Studio) (v2+)
First thing you'll want to try is to run the Function host locally.
- Set the WebJobs.Script.WebHost to the startup project
- Change the debug configuration to "WebJobs.Script.WebHost.Core"
AzureWebJobsScriptRootsetting pointing at your test project
- You can add this variable a few ways:
- Add a Environment Variable via a global variable (have to restart VS afterwards)
- Add a setting to appsettings.json (be careful not to check it in)
- Add an environment variable via the Debug configuration for the project (be careful not to check it in)
- You can create a simple hello world function app via the function core tools CLI. In a sample directory just run:
The output of $PWD is your current directory, use that full path
- You can add this variable a few ways:
- Click debug - this should launch a new terminal and browser window. If you created a new http triggered function named "hello", you should be able to add "api/hello" to your base URL and see your Function's response and the
context.logstatement in the terminal.
If you want to test anything other than HTTP, it will require the
AzureWebJobsDashboard settings get set to an Azure Storage Account connection string. You'll also need to add settings for any non-storage services you might want to connect to. You can do this via the same 3 methods described above.
Running tests (Visual Studio)
There are three test projects in the WebJobs.Script solution
The only thing you need to set up for the tests is your Storage Account for the integration tests. You need to set the
AzureWebJobsDashboard settings for WebJobs.Script.Tests.Integration project. The appsettings.json method is pretty clean, but you need to create it. Be sure "CopyToOutput" is true and rebuild afterwards for the appsettings.json file. To run end to end (E2E) tests, see the set up requirements for Samples under Home.
Then open up for your test explorer (CTRL+E, T) and click Run All. If any fail, you might have set something up wrong locally.
The general flow for making a change to the script host is:
- 🍴 Fork the repo (add the fork via
git remote add me <clone url here>
- 🌳 Create a branch for your change (generally use dev) (
git checkout -b my-change)
- 🛠 Make your change
- ✔️ Test your changes
- ⬆️ Push your changes to your fork (
git push me my-change)
- 💌 Open a PR to the dev branch
- 📢 Address feedback and make sure tests pass (yes even if it's an "unrelated" test failure)
- 📦 Rebase your changes into a meaningful commits (
git rebase -i HEAD~Nwhere
Nis commits you want to squash)
- Rebase and merge (This will be done for you if you don't have contributor access)
- ✂️ Delete your branch (optional)
- Leave comments on your PR and @ people for attention
- @AzureFunctions on twitter
- (MSFT Internal only) Functions Dev teams channel & email