Skip to content

Commit 6aab65f

Browse files
authored
Merge branch 'main' into codeql
2 parents e16d7ea + 6b8ae68 commit 6aab65f

9 files changed

Lines changed: 524 additions & 48 deletions

File tree

.github/workflows/unit-test-and-coverage-gate.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ jobs:
4646
INPUT_COV_THRESHOLD: ${{ inputs.cov_threshold }}
4747
run: |
4848
# Read threshold from file, allow manual override
49-
FILE_THRESHOLD=$(cat .coverage-threshold 2>/dev/null || echo "65.0")
49+
# Use fallback 65.0 if file is missing, empty, or unreadable
50+
FILE_THRESHOLD=$(cat .coverage-threshold 2>/dev/null | tr -d '[:space:]')
51+
FILE_THRESHOLD="${FILE_THRESHOLD:-65.0}"
5052
COV_THRESHOLD="${INPUT_COV_THRESHOLD:-$FILE_THRESHOLD}"
53+
# Validate it's a number, otherwise use fallback
54+
if ! [[ "$COV_THRESHOLD" =~ ^[0-9]+\.?[0-9]*$ ]]; then
55+
echo "::warning::Invalid threshold '$COV_THRESHOLD', using 65.0"
56+
COV_THRESHOLD="65.0"
57+
fi
5158
echo "cov_threshold=${COV_THRESHOLD}" >> "$GITHUB_OUTPUT"
5259
echo "build_id=${GITHUB_RUN_ID}" >> "$GITHUB_OUTPUT"
5360
if [[ -n "${INPUT_COV_THRESHOLD}" ]]; then
@@ -89,7 +96,8 @@ jobs:
8996
# Extract numeric values using simpler patterns
9097
OVERALL=$(grep "Overall Coverage:" coverage_report.txt | sed 's/[^0-9.]*\([0-9.]\+\)%.*/\1/')%
9198
THRESHOLD=$(grep "Threshold:" coverage_report.txt | sed 's/[^0-9.]*\([0-9.]\+\)%.*/\1/')%
92-
STATUS=$(grep "Status:" coverage_report.txt | sed 's/[^A-Z]*\([A-Z]\+\).*/\1/')
99+
# Get last word on the Status line (PASSED or FAILED)
100+
STATUS=$(grep "Status:" coverage_report.txt | awk '{print $NF}')
93101
94102
# Status badge
95103
if [[ "$STATUS" == "PASSED" ]]; then

Earthfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,13 @@ test:
153153

154154
# Run the comprehensive coverage tests using our script
155155
# Args: COV_THRESHOLD PRINT_TS FAIL_ON_NO_TESTS DEBUG
156-
# If COV_THRESHOLD not provided, read from .coverage-threshold file
156+
# If COV_THRESHOLD not provided or empty, read from .coverage-threshold file
157157
RUN cd /work && \
158-
THRESHOLD="${COV_THRESHOLD:-$(cat .coverage-threshold 2>/dev/null || echo 65.0)}" && \
158+
FILE_THRESH=$(cat .coverage-threshold 2>/dev/null | tr -d '[:space:]') && \
159+
FILE_THRESH="${FILE_THRESH:-65.0}" && \
160+
THRESHOLD="${COV_THRESHOLD:-$FILE_THRESH}" && \
161+
THRESHOLD="${THRESHOLD:-65.0}" && \
162+
echo "Using coverage threshold: ${THRESHOLD}%" && \
159163
./scripts/run_coverage_tests.sh "${THRESHOLD}" "${PRINT_TS}" "${FAIL_ON_NO_TESTS}"
160164

161165
# Save coverage artifacts locally
@@ -176,9 +180,13 @@ test-debug:
176180

177181
# Run the coverage tests with debug output (keeps temp files for inspection)
178182
# Args: COV_THRESHOLD PRINT_TS FAIL_ON_NO_TESTS DEBUG
179-
# If COV_THRESHOLD not provided, read from .coverage-threshold file
183+
# If COV_THRESHOLD not provided or empty, read from .coverage-threshold file
180184
RUN cd /work && \
181-
THRESHOLD="${COV_THRESHOLD:-$(cat .coverage-threshold 2>/dev/null || echo 65.0)}" && \
185+
FILE_THRESH=$(cat .coverage-threshold 2>/dev/null | tr -d '[:space:]') && \
186+
FILE_THRESH="${FILE_THRESH:-65.0}" && \
187+
THRESHOLD="${COV_THRESHOLD:-$FILE_THRESH}" && \
188+
THRESHOLD="${THRESHOLD:-65.0}" && \
189+
echo "Using coverage threshold: ${THRESHOLD}%" && \
182190
./scripts/run_coverage_tests.sh "${THRESHOLD}" "${PRINT_TS}" "${FAIL_ON_NO_TESTS}" "true"
183191

184192
# Save coverage artifacts locally
Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
# Configuring Multiple Package Repositories
2+
3+
## Overview
4+
5+
The OS Image Composer supports adding multiple custom package repositories to your image builds through the `packageRepositories` section in image template files. This feature allows you to include packages from additional repositories beyond the default OS repositories, enabling you to integrate specialized software, proprietary packages, or packages from specific vendors into your custom images.
6+
7+
## How It Works
8+
9+
Package repositories are configured during the image build process and are added to the package manager configuration before any packages are installed. This ensures that packages from custom repositories are available during the package installation phase, allowing you to install packages from multiple sources in a single build.
10+
11+
## Configuration Structure
12+
13+
The `packageRepositories` section should be placed at the root level of your image template YAML file, alongside other top-level configuration sections:
14+
15+
```yaml
16+
image:
17+
name: your-image-name
18+
version: "1.0"
19+
20+
target:
21+
os: ubuntu
22+
dist: ubuntu24
23+
arch: x86_64
24+
imageType: raw
25+
26+
# Package repositories are configured before any other operations
27+
packageRepositories:
28+
- codename: "EdgeAI"
29+
url: "https://yum.repos.intel.com/edgeai/"
30+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
31+
32+
disk:
33+
name: ....
34+
# .... other disk configuration
35+
36+
systemConfig:
37+
name: ....
38+
packages:
39+
- ubuntu-minimal
40+
- edge-ai-package # This package comes from the EdgeAI repository
41+
# .... other packages
42+
```
43+
44+
## Repository Configuration Properties
45+
46+
Each repository entry supports the following properties:
47+
48+
- **codename** (required): A unique identifier for the repository
49+
- **url** (required): The base URL of the package repository
50+
- **pkey** (strongly recommended): URL to the GPG public key for repository authentication. Technically this field is optional, but omitting it (or using `[trusted=yes]` to bypass GPG verification) should be limited to explicitly trusted internal repositories, as it disables signature verification and reduces security.
51+
52+
## Complete Template Structure
53+
54+
Here's how the packageRepositories section fits within a complete image template:
55+
56+
```yaml
57+
image:
58+
name: multi-repo-image
59+
version: "1.0"
60+
61+
target:
62+
os: ubuntu
63+
dist: ubuntu24
64+
arch: x86_64
65+
imageType: raw
66+
67+
# Multiple package repositories configuration
68+
packageRepositories:
69+
- codename: "EdgeAI"
70+
url: "https://yum.repos.intel.com/edgeai/"
71+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
72+
73+
- codename: "edge-base"
74+
url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base"
75+
pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY"
76+
77+
disk:
78+
name: ....
79+
# .... disk configuration
80+
81+
systemConfig:
82+
name: ....
83+
description: ....
84+
85+
packages:
86+
- ubuntu-minimal
87+
- openvino-toolkit # From OpenVINO repository
88+
- edge-ai-runtime # From EdgeAI repository
89+
- microvisor-base # From edge-base repository
90+
# .... other packages from various repositories
91+
92+
kernel:
93+
version: ....
94+
# .... kernel configuration
95+
96+
configurations:
97+
# .... custom configurations
98+
```
99+
100+
## Real-World Example
101+
102+
A comprehensive multi-repository configuration for edge computing and AI workloads:
103+
104+
```yaml
105+
packageRepositories:
106+
- codename: "EdgeAI"
107+
url: "https://yum.repos.intel.com/edgeai/"
108+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
109+
110+
- codename: "edge-base"
111+
url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base"
112+
pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY"
113+
114+
- codename: "OpenVINO"
115+
url: "https://yum.repos.intel.com/openvino/"
116+
pkey: "https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB"
117+
118+
- codename: "mariner"
119+
url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/"
120+
pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key"
121+
```
122+
123+
## Repository Configuration Examples
124+
125+
### Intel Edge AI Stack
126+
127+
```yaml
128+
packageRepositories:
129+
- codename: "EdgeAI"
130+
url: "https://yum.repos.intel.com/edgeai/"
131+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
132+
133+
- codename: "OpenVINO"
134+
url: "https://yum.repos.intel.com/openvino/"
135+
pkey: "https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB"
136+
137+
systemConfig:
138+
packages:
139+
- openvino-toolkit
140+
- edge-ai-runtime
141+
- intel-media-driver
142+
# ....
143+
```
144+
145+
### Microsoft and Intel Integration
146+
147+
```yaml
148+
packageRepositories:
149+
- codename: "mariner"
150+
url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/"
151+
pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key"
152+
153+
- codename: "edge-base"
154+
url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base"
155+
pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY"
156+
157+
systemConfig:
158+
packages:
159+
- mariner-base-packages
160+
- microvisor-runtime
161+
- edge-orchestration-tools
162+
# ....
163+
```
164+
165+
### Development Environment
166+
167+
```yaml
168+
packageRepositories:
169+
- codename: "docker-ce"
170+
url: "https://download.docker.com/linux/ubuntu"
171+
pkey: "https://download.docker.com/linux/ubuntu/gpg"
172+
173+
- codename: "nodejs"
174+
url: "https://deb.nodesource.com/node_18.x"
175+
pkey: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
176+
177+
systemConfig:
178+
packages:
179+
- docker-ce
180+
- docker-ce-cli
181+
- nodejs
182+
- npm
183+
# ....
184+
```
185+
186+
### Trusted Repository (No GPG Verification)
187+
188+
```yaml
189+
# WARNING: "[trusted=yes]" disables signature verification.
190+
# Only use this for repositories fully controlled by your organization,
191+
# typically in development or testing, and never for public or third-party repos.
192+
packageRepositories:
193+
- codename: "internal-repo"
194+
url: "https://internal.company.com/packages"
195+
pkey: "[trusted=yes]" # Bypasses GPG verification; ONLY for internal, organization-controlled repos.
196+
197+
- codename: "test-repo"
198+
url: "https://test.example.com/packages"
199+
pkey: "[trusted=yes]" # No signature verification; for internal dev/test only, not public/third-party repos.
200+
201+
systemConfig:
202+
packages:
203+
- internal-package
204+
- test-package
205+
# ....
206+
```
207+
208+
## Execution Process
209+
210+
### Repository Setup Phase
211+
212+
The build process follows this sequence when multiple repositories are configured:
213+
214+
1. **Repository Configuration**: All repositories in `packageRepositories` are added to the package manager
215+
2. **GPG Key Import**: Public keys are downloaded and imported for repository authentication (skipped for `[trusted=yes]` repositories)
216+
3. **Repository Refresh**: Package lists are updated from all configured repositories
217+
4. **Package Installation**: Packages from all repositories become available for installation
218+
219+
### Package Resolution
220+
221+
When packages are installed:
222+
223+
- The package manager searches all configured repositories
224+
- Dependencies can be resolved across multiple repositories
225+
- Repository priority may affect package selection when conflicts exist
226+
227+
## Best Practices
228+
229+
### 1. Always Include GPG Keys
230+
231+
Include GPG keys for repository authentication and security:
232+
233+
```yaml
234+
packageRepositories:
235+
# Good - includes GPG key for security
236+
- codename: "secure-repo"
237+
url: "https://example.com/packages"
238+
pkey: "https://example.com/gpg-key.pub"
239+
240+
# Use trusted=yes only for internal/trusted repositories
241+
- codename: "internal-repo"
242+
url: "https://internal.company.com/packages"
243+
pkey: "[trusted=yes]"
244+
245+
# Avoid - missing pkey entirely reduces security
246+
- codename: "insecure-repo"
247+
url: "https://example.com/packages"
248+
```
249+
250+
### 2. Use Descriptive Codenames
251+
252+
Choose clear, descriptive codenames that indicate the repository purpose:
253+
254+
```yaml
255+
packageRepositories:
256+
# Good - descriptive codenames
257+
- codename: "EdgeAI"
258+
- codename: "OpenVINO"
259+
- codename: "docker-ce"
260+
261+
# Avoid - unclear codenames
262+
- codename: "repo1"
263+
- codename: "custom"
264+
```
265+
266+
### 3. Verify Repository URLs
267+
268+
Ensure repository URLs are correct and accessible:
269+
270+
```yaml
271+
packageRepositories:
272+
# Verify these URLs are accessible during build
273+
- codename: "EdgeAI"
274+
url: "https://yum.repos.intel.com/edgeai/"
275+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
276+
```
277+
278+
### 4. Document Repository Sources
279+
280+
Add comments to document repository purposes:
281+
282+
```yaml
283+
packageRepositories:
284+
# Intel Edge AI packages for computer vision and inference
285+
- codename: "EdgeAI"
286+
url: "https://yum.repos.intel.com/edgeai/"
287+
pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg"
288+
289+
# Microsoft CBL-Mariner extended packages
290+
- codename: "mariner"
291+
url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/"
292+
pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key"
293+
```
294+
295+
## Security Considerations
296+
297+
### Repository Trust
298+
299+
- Only add repositories from trusted sources
300+
- Always include GPG keys for repository authentication when available
301+
- Use `pkey: "[trusted=yes]"` only when GPG keys are unavailable and the repository is under your organization's direct control
302+
- Regularly review and update repository configurations
303+
- Be cautious with repositories that don't provide GPG keys
304+
305+
### Network Security
306+
307+
- Use HTTPS URLs when available
308+
- Consider using local repository mirrors for improved security and performance
309+
- Validate GPG key fingerprints when possible
310+
311+
## Related Documentation
312+
313+
- [Image Template Format](../architecture/image-template-format.md)
314+
- [Understanding the OS Image Build Process](../architecture/os-image-composer-build-process.md)
315+
- [Configuring Custom Commands During Image Build](configure-additional-actions-for-build.md)

0 commit comments

Comments
 (0)