Skip to content

Commit 87b6c02

Browse files
committed
Add Test-Published task for testing images from a registry
firebird-docker.build.ps1: - New task Test-Published: runs the full test suite against final published images (ghcr.io/<owner>/firebird:tag) — same images end users pull. Pulls each image before testing. Requires -Registry. Unlike Test (which targets local arch-specific staging images), this exercises the actual multi-arch manifest from the registry. CONTRIBUTING.md: - Document Test-Published with usage examples - Document snapshot testing via FULL_IMAGE_NAME override
1 parent f06b5f4 commit 87b6c02

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,30 @@ Invoke-Build Test -TestFilter "FIREBIRD_USER_can_create_user"
7474
Invoke-Build Test -VersionFilter "5" -DistributionFilter "noble"
7575
```
7676

77+
### Testing published registry images
78+
79+
Use `Test-Published` to run the full test suite against images already pushed to a registry (the same final images end users pull). Requires `-Registry`.
80+
81+
```bash
82+
# Test all images published to a fork's ghcr.io registry
83+
Invoke-Build Test-Published -Registry "ghcr.io/myusername"
84+
85+
# Narrow down to a specific version + distro
86+
Invoke-Build Test-Published -Registry "ghcr.io/myusername" -VersionFilter "5.0.3" -DistributionFilter "bookworm"
87+
88+
# Test the official Docker Hub images
89+
Invoke-Build Test-Published -Registry "firebirdsql"
90+
```
91+
92+
Unlike `Test` (which tests locally built arch-specific staging images), `Test-Published` pulls and tests the final multi-arch manifest — exactly what a user would run.
93+
94+
For snapshot images (not in `assets.json`), set `FULL_IMAGE_NAME` directly:
95+
96+
```bash
97+
$env:FULL_IMAGE_NAME = "ghcr.io/myusername/firebird:6-snapshot"
98+
Invoke-Build * ./src/image.tests.ps1
99+
```
100+
77101
### Tag unit tests
78102

79103
```bash

firebird-docker.build.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,51 @@ task Test FilteredAssets, {
354354
}
355355
}
356356

357+
# Synopsis: Test published images pulled directly from a registry (requires -Registry).
358+
# Unlike Test (which uses locally built arch-specific images), this task tests the final
359+
# published images — the same ones end users pull.
360+
#
361+
# Examples:
362+
# Invoke-Build Test-Published -Registry 'ghcr.io/myusername'
363+
# Invoke-Build Test-Published -Registry 'ghcr.io/myusername' -VersionFilter '5.0.3' -DistributionFilter 'bookworm'
364+
# Invoke-Build Test-Published -Registry 'firebirdsql'
365+
task Test-Published FilteredAssets, {
366+
$imagePrefix = $script:imagePrefix
367+
$imageName = 'firebird'
368+
$testFile = './src/image.tests.ps1'
369+
370+
if (-not $imagePrefix) {
371+
Write-Error "Use -Registry to specify which registry to test. Example: Invoke-Build Test-Published -Registry 'ghcr.io/myusername'"
372+
exit 1
373+
}
374+
375+
if ($TestFilter) {
376+
Write-Verbose "Running single test '$TestFilter'..."
377+
} else {
378+
Write-Verbose "Running all tests..."
379+
$TestFilter = '*'
380+
}
381+
382+
$assets | ForEach-Object {
383+
$asset = $_
384+
385+
$asset.tags | Get-Member -MemberType NoteProperty | ForEach-Object {
386+
$distribution = $_.Name
387+
# Use the most-specific tag (first in list, e.g. '5.0.3-bookworm') to avoid
388+
# accidentally re-testing the same image under an alias tag.
389+
$tag = $asset.tags.$distribution | Select-Object -First 1
390+
391+
Write-Build Magenta "----- [$($asset.version) / $distribution] -----"
392+
393+
$env:FULL_IMAGE_NAME = "$imagePrefix/${imageName}:$tag"
394+
Write-Build Cyan " Pulling $($env:FULL_IMAGE_NAME)..."
395+
docker pull $env:FULL_IMAGE_NAME *>&1 | Select-String 'Status:|Error' | Write-Build DarkGray
396+
Invoke-Build $TestFilter $testFile
397+
}
398+
}
399+
}
400+
401+
357402
# Synopsis: Retag and push images using the final name (no -arch suffix). Use for single-arch publishing.
358403
# Produces only one package (e.g. ghcr.io/owner/firebird) with no staging intermediates.
359404
task Publish-Direct FilteredAssets, {

0 commit comments

Comments
 (0)