Skip to content

Commit 42218e9

Browse files
machvJaromir Kaspar
andauthored
Github Action & Telemetry (#363)
* Introduce Github Action workflow to automate the builds of WSLab scripts * Add support for Telemetry collection to Application Insights * Deprecate Scripts.zip file in the repository in favor of Releases feature in Github Co-authored-by: Jaromir Kaspar <jaromirk@microsoft.com> Former-commit-id: c373ca5
1 parent 9919e1f commit 42218e9

12 files changed

Lines changed: 875 additions & 132 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Create release
2+
3+
defaults:
4+
run:
5+
shell: powershell
6+
7+
on:
8+
push:
9+
paths:
10+
- 'Scripts/**'
11+
branches: [ master ]
12+
13+
jobs:
14+
new-version:
15+
name: Bump version
16+
runs-on: windows-2019
17+
outputs:
18+
previous_tag: ${{ steps.bump.outputs.previous_tag }}
19+
new_tag: ${{ steps.bump.outputs.new_tag }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
- id: bump
23+
name: Bump version
24+
run: |
25+
$today = Get-Date
26+
$newVersion = @($today.ToString("yy"), $today.ToString("MM"), "1")
27+
git fetch --tags
28+
$hash = git rev-list --tags --topo-order --max-count=1
29+
if($hash) {
30+
$currentTag = git describe --tags $hash
31+
$parts = $currentTag.Substring(1) -split '\.'
32+
if($parts[1] -eq $today.ToString("MM") -and $parts[0] -eq $today.ToString("yy")) { $newVersion[2] = ([int]$parts[2] + 1).ToString("0") }
33+
}
34+
35+
$newTag = "v" + ($newVersion -join ".")
36+
git tag $newTag
37+
"New version: $newTag"
38+
echo "::set-output name=previous_tag::$currentTag"
39+
echo "::set-output name=new_tag::$newTag"
40+
41+
- name: Push version tag
42+
uses: ad-m/github-push-action@master
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
tags: true
46+
47+
new-release:
48+
name: Create release
49+
runs-on: windows-2019
50+
needs: new-version
51+
steps:
52+
- uses: actions/checkout@v2
53+
with:
54+
fetch-depth: 0
55+
- name: Build scripts
56+
shell: powershell
57+
run: |
58+
./build.ps1 -Version ${{ needs.new-version.outputs.new_tag }}
59+
60+
- name: Create changelog
61+
id: changelog
62+
shell: powershell
63+
run: |
64+
if("${{ needs.new-version.outputs.previous_tag }}" -ne "") {
65+
$changelog = (& { git log ${{ needs.new-version.outputs.previous_tag }}..HEAD --pretty=format:'- %s (%h)' --abbrev-commit -- Scripts }) -join '%0D%0A'
66+
"Changes for ${{ needs.new-version.outputs.previous_tag }} are:"
67+
$changelog
68+
} else {
69+
$changelog = ""
70+
}
71+
echo "::set-output name=changelog::$changelog"
72+
73+
- name: Create Github Release
74+
id: create_release
75+
uses: actions/create-release@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
tag_name: ${{ needs.new-version.outputs.new_tag }} # ${{ github.ref }}
80+
release_name: Release ${{ needs.new-version.outputs.new_tag }} # ${{ github.ref }}
81+
body: |
82+
Changes in this version:
83+
${{ steps.changelog.outputs.changelog }}
84+
draft: false
85+
prerelease: false
86+
87+
- name: Upload ZIP to Release
88+
id: upload-scripts
89+
uses: actions/upload-release-asset@v1
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
with:
93+
upload_url: ${{ steps.create_release.outputs.upload_url }}
94+
asset_path: ./Release.zip
95+
asset_name: wslab_${{ needs.new-version.outputs.new_tag }}.zip
96+
asset_content_type: application/zip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/Output
2+
Release.zip

Docs/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- name: Hydration
2+
href: wslab-hydration.md
3+
- name: Deployment
4+
href: wslab-deployment.md
5+
- name: Telemetry
6+
href: wslab-telemetry.md

Docs/wslab-telemetry.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# WSLab Telemetry
2+
3+
## Introduction
4+
5+
We started to collect telemetry to better understand impact of WSLab scripts as currently we cannot determine number of VMs deployed and where is WSLab being used. Data are hosted in Azure Application Insights and it is absolutely transparent what information is being collected, since all is visible in PowerShell Scripts.
6+
7+
Currently there is no public facing interface, however we plan to create PowerBI dashboards, where we will present Leader Boards and some nice statistics - such as how many VMs were deployed and we will be able to create statistics that will show in what countries is WSLab running and many more
8+
9+
## Verbosity level
10+
11+
Currently there are 3 different levels: **None**, **Basic** and **Full**. If nothing is configured in LabConfig, you will be asked to provide your preferred option.
12+
13+
### None
14+
15+
If you don't want to send anything, or if you are in offline environment.
16+
17+
### Basic
18+
19+
Sends information about deployed lab, that is vital for us to understand impact of WSLab scripts.
20+
21+
### Full
22+
23+
Provides enhanced information such as computer model, amount of RAM and number of cores. This information is not essential, however i will provide interesting insight.
24+
25+
## LabConfig examples
26+
27+
Basic telemetry level
28+
29+
```powershell
30+
$LabConfig = @{
31+
DomainAdminName = 'LabAdmin'
32+
AdminPassword = 'LS1setup!'
33+
Prefix = 'WSLab-'
34+
DCEdition = '4'
35+
Internet = $true
36+
TelemetryLevel = 'Basic'
37+
AdditionalNetworksConfig = @()
38+
VMs = @()
39+
}
40+
41+
```
42+
43+
Full telemetry including NickName that will be included in LeaderBoards once we will publish PowerBI statistics.
44+
45+
```powershell
46+
$LabConfig = @{
47+
DomainAdminName = 'LabAdmin'
48+
AdminPassword = 'LS1setup!'
49+
Prefix = 'WSLab-'
50+
DCEdition = '4'
51+
Internet = $true
52+
TelemetryLevel = 'Full'
53+
TelemetryNickname = 'Jaromirk'
54+
AdditionalNetworksConfig = @()
55+
VMs = @()
56+
}
57+
58+
```
59+
60+
## Collected information
61+
62+
These properties are attached to every telemetry event that is sent to the Application Insights workspace.
63+
64+
| | Basic | Full |Description| Sample Value | Application Insights property |
65+
|---------------------|:-----:|:----:|-----------| --- | ---- |
66+
| Application Version | x | x | Version of WSLab Scripts | v20.07.1 | `ai.application.ver` |
67+
| Telemetry Level | x | x | Which level of telemetry has been set | Full | `telemetry.level` |
68+
| Product type | x | x | Workstation or Server| Workstation | `os.type` |
69+
| Session ID | x | x | One-way hash (`SHA1`) of `MachineGUID`, `PSScriptRoot` and `ComputerName`. Purpose of this session ID is only to link execution of separate scripts within the same lab folder. | 482e33a99e6fb41e5f739d9294ac1b339c7c3c60 | `ai.session.id` |
70+
| Device Locale | x | x | Locale of Host OS | en-US | `ai.device.locale` |
71+
| PowerShell Edition | x | x | Desktop or Core | Core | `powershell.edition` |
72+
| PowerShell Version | x | x | version | 7.0.2 | `powershell.version` |
73+
| TotalDuration | x | x | Duration of script run in seconds | 23,62 | `TotalDuration` |
74+
| Device Manufacturer | | x | Device Manufacturer | LENOVO | `ai.device.oemName` |
75+
| Device model | | x | Device model based on `Win32_ComputerSystem` | ThinkPad P52 | `ai.device.model` |
76+
| Operating System | | x | OS SKU and build | Windows 10 Enterprise (10.0.19041.388)| `ai.device.os` |
77+
| OS Build | | x | OS Build Number | 19041 | `os.build` |
78+
| Amount of RAM | | x | Total amount of RAM in MB | 65311 | `memory.total` |
79+
| Number of Sockets | | x | How many sockets system have | 1 | `cpu.sockets.count` |
80+
| Number of Cores | | x | Total number of CPU cores available | 12 | `cpu.logical.count` |
81+
| Volume Capacity | | x | Capacity of a volume where WSLab was run (in GB) | 954 | `volume.size` |
82+
| Disk Model | | x | Friendly name of a disk where volume with WSLab was run | Samsung SSD 970 PRO 1TB | `disk.model` |
83+
| Disk Media Type | | x | Type of the disk where WSLab was run | SSD | `disk.type` |
84+
| Disk Bus type | | x | Bus connection of the disk where WSLab was run | NVMe | `disk.busType` |
85+
86+
### Specific Events for 2_CreateParentDisks.ps1 script
87+
88+
#### CreateParentDisks.Start
89+
When script is started.
90+
#### CreateParentDisks.Vhd
91+
For each hydrated VHD parent disk.
92+
#### CreateParentDisks.End
93+
When script finished.
94+
95+
### Specific Events to Deploy.ps1 script
96+
97+
#### Deploy.Start
98+
When script is started.
99+
100+
#### Deploy.VM
101+
For each provisioned VM.
102+
103+
#### Deploy.End
104+
When script finished.
105+
106+
| |Basic|Full|Description|
107+
|-----------------------------|:---:|:--:|-----------|
108+
|VMDeploymentDuration |x |x |Duration of Deploy.ps1 script|
109+
|Deployed VM OSBuild |x |x |For example 19041|
110+
|Deployed VM InstallationType |x |x |For example Server Core|
111+
|Deployed VM OsVersion |x |x |For example 10.0.17763.1282|
112+
|Deployed VM EditionID |x |x |For example ServerDatacenter|
113+
114+
### Specific to Cleanup.ps1
115+
116+
| |Basic|Full|Description|
117+
|-----------|:---:|:--:|-----------|
118+
| lab.removed.count |x |x |Number of removed VMs|
119+
120+
121+

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# WSLab Introduction
22

3+
| Last Update | Latest Release | |
4+
| --- | --- | -- |
5+
| [![GitHub last commit](https://img.shields.io/github/last-commit/Microsoft/wslab/master.svg?style=flat-square)]() | [![GitHub release](https://img.shields.io/github/release/microsoft/wslab.svg?style=flat-square)](https://aka.ms/wslab/download) | [![Download](https://img.shields.io/static/v1?label=&message=Download+WSLab&color=green&style=for-the-badge)](https://aka.ms/wslab/download) |
6+
37
<!-- TOC -->
48

59
- [WSLab Introduction](#wslab-introduction)

0 commit comments

Comments
 (0)