Skip to content

Commit

Permalink
Implement iotedge check to perform basic tests for common issues (#…
Browse files Browse the repository at this point in the history
…1051)

Cherry-pick from master of:

- 22ef977 Implement `iotedge check` to perform basic tests for common issues (#777)
- f7e820f `iotedge check` improvements (#926)
- 63dc883 `iotedge check` improvements part 2 (#1018)
  • Loading branch information
arsing authored Apr 5, 2019
1 parent ce232a8 commit 1d74b97
Show file tree
Hide file tree
Showing 53 changed files with 3,269 additions and 338 deletions.
46 changes: 43 additions & 3 deletions builds/misc/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,39 @@ jobs:
- script: scripts/linux/installPrereqs.sh -u $(NetCorePackageUri)
name: install
displayName: Install dependencies

- bash: 'docker login $(registry.address) --username $(registry.user) --password $(registry.password)'
displayName: 'Docker Login'

- script: edgelet/build/linux/install.sh --package-arm
displayName: Install Rust

- bash: 'echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH"'
displayName: Modify path

- bash: 'cargo install --git https://github.com/arsing/cross.git --branch set-path'
displayName: 'Install cross (fork with docker fix)'

- script: scripts/linux/buildBranch.sh -c Release --no-rocksdb-bin
name: build
displayName: Build (release)

- script: scripts/linux/buildDiagnostics.sh
displayName: Build iotedge-diagnostics

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: '$(Build.BinariesDirectory)/publish'
ArtifactName: 'core-linux'

# azureiotedge-diagnostics
- template: templates/image-linux.yaml
parameters:
name: azureiotedge-diagnostics
imageName: azureiotedge-diagnostics
project: azureiotedge-diagnostics

# Edge Agent
- template: templates/image-linux.yaml
parameters:
Expand Down Expand Up @@ -106,16 +130,30 @@ jobs:
- powershell: scripts/windows/setup/Install-Prerequisites.ps1 -DotnetSdkUrl $(NetCorePackageUri) -Dotnet -Nuget
name: install
displayName: Install

- script: echo $(registry.password)|docker login "edgebuilds.azurecr.io" -u "$(registry.user)" --password-stdin
displayName: Docker Login

- powershell: scripts/windows/build/Publish-Branch.ps1 -Configuration:"Release" -PublishTests:$False -UpdateVersion
name: build
displayName: Build

- powershell: edgelet/build/windows/build-diagnostics.ps1
displayName: Build iotedge-diagnostics

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: '$(Build.BinariesDirectory)/publish'
ArtifactName: 'core-windows'
- script: echo $(registry.password)|docker login "edgebuilds.azurecr.io" -u "$(registry.user)" --password-stdin
displayName: Docker Login

# azureiotedge-diagnostics
- template: templates/image-windows.yaml
parameters:
name: azureiotedge-diagnostics
imageName: azureiotedge-diagnostics
project: azureiotedge-diagnostics
arm32v7: 'false'

# Edge Agent
- template: templates/image-windows.yaml
Expand Down Expand Up @@ -201,4 +239,6 @@ jobs:
- script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edge-hub/docker/manifest.yaml.template -n microsoft --tags "$(tags)"
displayName: 'Publish Edge Hub Manifest'
- script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template -n microsoft --tags "$(tags)"
displayName: 'Publish Temperature Sensor Manifest'
displayName: 'Publish Temperature Sensor Manifest'
- script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edgelet/iotedge-diagnostics/docker/manifest.yaml.template -n microsoft --tags "$(tags)"
displayName: 'Publish azureiotedge-diagnostics Manifest'
70 changes: 64 additions & 6 deletions edgelet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions edgelet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"docker-rs",
"dps",
"edgelet-config",
"edgelet-core",
"edgelet-docker",
"edgelet-hsm",
Expand All @@ -19,8 +20,10 @@ members = [
"iotedge",
"iotedged",
"iotedged-eventlog-messages",
"iotedge-diagnostics",
"iothubservice",
"management",
"mini-sntp",
"provisioning",
"systemd",
"tokio-named-pipe",
Expand Down
5 changes: 5 additions & 0 deletions edgelet/Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ passthrough = [

[target.armv7-unknown-linux-gnueabihf]
image = "azureiotedge/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf:0.2"

[target.armv7-unknown-linux-musleabihf]
# Built from rust-embedded/cross#718a19cd68fb09428532d1317515fe7303692b47 with `./build-docker-image.sh armv7-unknown-linux-musleabihf`
# because the image in Docker hub is outdated and broken
image = "azureiotedge/armv7-unknown-linux-musleabihf:0.1"
46 changes: 46 additions & 0 deletions edgelet/build/windows/build-diagnostics.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) Microsoft. All rights reserved.

<#
# Builds and publishes to target/publish/ the iotedge-diagnostics binary and its associated dockerfile
#>

$ErrorActionPreference = 'Continue'

. (Join-Path $PSScriptRoot 'util.ps1')

Assert-Rust

$cargo = Get-CargoCommand
$ManifestPath = Get-Manifest

$versionInfoFilePath = Join-Path $env:BUILD_REPOSITORY_LOCALPATH 'versionInfo.json'
$env:VERSION = Get-Content $versionInfoFilePath | ConvertFrom-JSON | % version
$env:NO_VALGRIND = 'true'

$originalRustflags = $env:RUSTFLAGS
$env:RUSTFLAGS += ' -C target-feature=+crt-static'
Write-Host "$cargo build -p iotedge-diagnostics --release --manifest-path $ManifestPath"
Invoke-Expression "$cargo build -p iotedge-diagnostics --release --manifest-path $ManifestPath"
if ($originalRustflags -eq '') {
Remove-Item Env:\RUSTFLAGS
}
else {
$env:RUSTFLAGS = $originalRustflags
}
if ($LastExitCode) {
Throw "cargo build failed with exit code $LastExitCode"
}

$ErrorActionPreference = 'Stop'

$publishFolder = [IO.Path]::Combine($env:BUILD_BINARIESDIRECTORY, 'publish', 'azureiotedge-diagnostics')

New-Item -Type Directory $publishFolder

Copy-Item -Recurse `
([IO.Path]::Combine($env:BUILD_REPOSITORY_LOCALPATH, 'edgelet', 'iotedge-diagnostics', 'docker')) `
([IO.Path]::Combine($publishFolder, 'docker'))

Copy-Item `
([IO.Path]::Combine($env:BUILD_REPOSITORY_LOCALPATH, 'edgelet', 'target', 'release', 'iotedge-diagnostics.exe')) `
([IO.Path]::Combine($publishFolder, 'docker', 'windows', 'amd64'))
1 change: 1 addition & 0 deletions edgelet/build/windows/iotedge.wm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<file source="$(_REPO_ROOT)\edgelet\target\release\iotedged_eventlog_messages.dll" destinationDir="$(runtime.programFiles)\iotedge" />
<file source="$(_REPO_ROOT)\edgelet\hsm-sys\azure-iot-hsm-c\build\Release\iothsm.dll" destinationDir="$(runtime.programFiles)\iotedge" />
<file source="$(_OPENSSL_ROOT_DIR)\bin\libeay32.dll" destinationDir="$(runtime.programFiles)\iotedge" />
<file source="$(_OPENSSL_ROOT_DIR)\bin\ssleay32.dll" destinationDir="$(runtime.programFiles)\iotedge" />
<file source="$(_REPO_ROOT)\edgelet\contrib\docs\LICENSE" destinationDir="$(runtime.programFiles)\iotedge\LICENSE" />
<file source="$(_REPO_ROOT)\edgelet\contrib\docs\ThirdPartyNotices" destinationDir="$(runtime.programFiles)\iotedge\LICENSE" />
<file source="$(_REPO_ROOT)\edgelet\contrib\docs\trademark" destinationDir="$(runtime.programFiles)\iotedge\LICENSE" />
Expand Down
5 changes: 4 additions & 1 deletion edgelet/build/windows/util.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright (c) Microsoft. All rights reserved.

New-Item -Type Directory -Force '~/.cargo/bin'
$env:PATH += ";$(Resolve-Path '~/.cargo/bin')"

function Test-RustUp
{
(get-command -Name rustup.exe -ErrorAction SilentlyContinue) -ne $null
Expand Down Expand Up @@ -35,7 +38,7 @@ function Assert-Rust
Throw "Failed to download rustup with exit code $LastExitCode"
}

Write-Host "Running rustup.exe"
Write-Host "Running rustup-init.exe"
./rustup-init.exe -y --default-toolchain stable-x86_64-pc-windows-msvc
if ($LastExitCode)
{
Expand Down
12 changes: 11 additions & 1 deletion edgelet/contrib/config/linux/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ hostname: "<ADD HOSTNAME HERE>"
###############################################################################
#
#
#Configures URIs used by clients of the management and workload APIs
# Configures URIs used by clients of the management and workload APIs
# management_uri - used by the Edge Agent and 'iotedge' CLI to start,
# stop, and manage modules
# workload_uri - used by modules to retrieve tokens and certificates
Expand All @@ -111,6 +111,11 @@ hostname: "<ADD HOSTNAME HERE>"
# http - connect over TCP
# unix - connect over Unix domain socket
#
# Note: When using the fd:// scheme for listen.management_uri or listen.workload_uri,
# the path of connect.management_uri and connect.workload_uri must match
# the path of the underlying socket in the systemd socket files
# (iotedge.socket and iotedge.mgmt.socket).
#
###############################################################################

connect:
Expand All @@ -136,6 +141,11 @@ connect:
# listen address is fd://iotedge.workload,
# connect address is unix:///var/run/iotedge/workload.sock
#
# Note: When using the fd:// scheme for listen.management_uri or listen.workload_uri,
# the path of connect.management_uri and connect.workload_uri must match
# the path of the underlying socket in the systemd socket files
# (iotedge.socket and iotedge.mgmt.socket).
#
###############################################################################

listen:
Expand Down
26 changes: 26 additions & 0 deletions edgelet/edgelet-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "edgelet-config"
version = "0.1.0"
authors = ["Azure IoT Edge Devs"]
publish = false

[dependencies]
base64 = "0.9"
config = "0.8"
failure = "0.1"
log = "0.4"
regex = "0.2"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sha2 = "0.7.0"
url = "1.7"
url_serde = "0.2"

edgelet-core = { path = "../edgelet-core" }
edgelet-utils = { path = "../edgelet-utils" }

[dev_dependencies]
tempdir = "0.3.7"

edgelet-docker = { path = "../edgelet-docker" }
Loading

0 comments on commit 1d74b97

Please sign in to comment.