microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1a84554b682a27ab81f3bacac1f03a17a6c7656a

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/lib/README.md

81lines · modecode

1---
2title: Shared Library
3description: Shared utility scripts and modules used across hve-core automation
4author: HVE Core Team
5ms.date: 2026-03-17
6ms.topic: reference
7keywords:
8 - powershell
9 - utilities
10 - ci
11 - downloads
12estimated_reading_time: 3
13---
14
15This directory contains shared utility scripts and modules used across the
16`hve-core` automation scripts.
17
18## Scripts
19
20### `Get-VerifiedDownload.ps1`
21
22Downloads and verifies artifacts using SHA256 checksums.
23
24Purpose: Provide tamper-evident file downloads for CI tooling.
25
26#### Features
27
28* Downloads files from a URL and verifies against an expected SHA256 hash
29* Supports optional extraction of archives
30* Exposes `Get-FileHashValue` and `Test-HashMatch` functions for reuse
31
32#### Parameters
33
34* `-Url` - Download URL
35* `-ExpectedSHA256` - Expected SHA256 hash for verification
36* `-OutputPath` - Local file path for the download
37* `-Extract` (switch) - Extract the downloaded archive after verification
38* `-ExtractPath` - Destination path for extraction
39
40#### Usage
41
42```powershell
43# Download and verify a tool
44./scripts/lib/Get-VerifiedDownload.ps1 -Url "https://example.com/tool.zip" `
45 -ExpectedSHA256 "abc123..." -OutputPath "./tools/tool.zip"
46
47# Download, verify, and extract
48./scripts/lib/Get-VerifiedDownload.ps1 -Url "https://example.com/tool.zip" `
49 -ExpectedSHA256 "abc123..." -OutputPath "./tools/tool.zip" `
50 -Extract -ExtractPath "./tools/"
51```
52
53## Modules
54
55### `Modules/CIHelpers.psm1`
56
57Shared CI platform detection and output utilities imported by scripts across
58the repository.
59
60| Function | Purpose |
61|----------------------------------|--------------------------------------------------------|
62| `ConvertTo-GitHubActionsEscaped` | Escapes strings for GitHub Actions workflow commands |
63| `ConvertTo-AzureDevOpsEscaped` | Escapes strings for Azure DevOps logging commands |
64| `Get-CIPlatform` | Returns the current CI platform (GitHub, AzureDevOps) |
65| `Test-CIEnvironment` | Detects whether the script runs in a CI environment |
66| `Set-CIOutput` | Sets output variables for the current CI platform |
67| `Set-CIEnv` | Sets environment variables for the current CI platform |
68| `Write-CIStepSummary` | Appends content to the GitHub Actions step summary |
69| `Write-CIAnnotation` | Writes a single CI warning or error annotation |
70| `Write-CIAnnotations` | Writes multiple CI annotations from a violations array |
71| `Set-CITaskResult` | Sets the CI task result (succeeded, failed) |
72| `Publish-CIArtifact` | Publishes a file as a CI artifact |
73
74## Related Documentation
75
76* [Scripts README](../README.md) for overall script organization
77
78<!-- markdownlint-disable MD036 -->
79*🤖 Crafted with precision by ✨Copilot following brilliant human instruction,
80then carefully refined by our team of discerning human reviewers.*
81<!-- markdownlint-enable MD036 -->
82