IoT Edge is written in C# and Rust. The C# development setup is described below. The Rust development setup is described here.
Make sure the following dependencies are installed in your environment before you build IoT Edge code:
Dependency | Notes |
---|---|
.NET Core 3.1 | Installation instructions here. |
Java | Not needed if building in VS IDE (Windows). Otherwise, a JRE is required to compile the Antlr4 grammar files into C# classes, and java must be on your path. |
Besides using Visual Studio in Windows, you can build by running the build script:
scripts/linux/buildBranch.sh
scripts\windows\buildBranch.bat
Binaries are published to target/publish/
.
Besides using Test Explorer in Visual Studio, you can run the unit tests with:
scripts/linux/runTests.sh
dotnet test --filter Category=Unit
To run integration tests and/or BVTs, make sure the following dependencies are installed in your environment:
Dependency | Notes |
---|---|
Azure CLI | Installation instructions here |
Powershell | Installation instructions here |
Jq | Installation instructions here |
Docker | Installation instructions here. In Linux environments, be sure to follow the post-installation steps so the tests can run without sudo . |
The integration tests and BVTs expect to find certain values in an Azure KeyVault (see edge-util/test/Microsoft.Azure.Devices.Edge.Util.Test.Common/settings/base.json
). For the tests to access the KeyVault at runtime, a certificate must first be installed in the environment where the tests will run. Install the KeyVault certificate with:
az login # Login and select default subscription, if necessary
scripts/linux/downloadAndInstallCert.sh -v <VaultName> -c <CertName>
Argument | Description |
---|---|
VaultName | KeyVault name. See az keyvault secret show help. |
CertName | Certificate name. See --secret in az keyvault secret show help. |
Connect-AzureRmAccount # Login and select default subscription, if necessary
scripts\windows\setup\Install-VaultCertificate.ps1 -VaultName <VaultName> -CertificateName <CertificateName>
Argument | Description |
---|---|
VaultName | KeyVault name. See Get-AzureKeyVaultSecret help. |
CertName | Certificate name. See Get-AzureKeyVaultSecret help. |
Then run the tests either with Test Explorer in Visual Studio IDE, or with:
scripts/linux/runTests.sh "--filter Category=Integration"
dotnet test --filter Category=Integration
The syntax of the "filter" argument is described here. All IoT Edge tests are categorized as one of Unit
, Integration
, or Bvt
.
The end-to-end tests are documented here.
There is a script in the repo to build multi-architecture images. This script assumes that the platform specific images are already in the docker registry. Usage is as follows:
$ scripts/linux/buildManifest.sh --help
buildManifest.sh [options]
Note: Depending on the options you might have to run this as root or sudo.
options
-r, --registry Docker registry required to build, tag and run the module
-u, --username Docker Registry Username
-p, --password Docker Username's password
-v, --image-version Docker Image Version.
-t, --template Yaml file template for manifest definition.