Skip to content

Latest commit

 

History

History
116 lines (84 loc) · 4.61 KB

devguide.md

File metadata and controls

116 lines (84 loc) · 4.61 KB

Dev Guide

IoT Edge is written in C# and Rust. The C# development setup is described below. The Rust development setup is described here.

Setup

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.

Build

Besides using Visual Studio in Windows, you can build by running the build script:

Linux

scripts/linux/buildBranch.sh

Windows

scripts\windows\buildBranch.bat

Binaries are published to target/publish/.

Run unit tests

Besides using Test Explorer in Visual Studio, you can run the unit tests with:

Linux

scripts/linux/runTests.sh

Windows

dotnet test --filter Category=Unit

Run integration tests

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:

Linux

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.

Windows

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:

Linux

scripts/linux/runTests.sh "--filter Category=Integration"

Windows

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.

Run the end-to-end tests

The end-to-end tests are documented here.

Build Manifest Image

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.