Skip to content

Commit fbc5100

Browse files
Copilotdevstress
andcommitted
Add post-release validation to ensure latest packages work together
- Created validate-latest-release.ps1 script to test published packages - Tests FlinkDotnet from NuGet.org + flinkdotnet/jobgateway from Docker Hub - Added workflow validate-latest-release.yml for automated daily validation - Workflow creates issue if validation fails (catches compatibility issues) - Updated README with pre-release and post-release validation usage Co-authored-by: devstress <30769729+devstress@users.noreply.github.com>
1 parent 8a05f13 commit fbc5100

File tree

3 files changed

+247
-2
lines changed

3 files changed

+247
-2
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Validate Latest Release
2+
3+
on:
4+
# Run on-demand to validate latest published packages
5+
workflow_dispatch:
6+
inputs:
7+
docker_tag:
8+
description: 'Docker tag to test (default: latest)'
9+
required: false
10+
default: 'latest'
11+
# Run on schedule (daily) to catch compatibility issues
12+
schedule:
13+
- cron: '0 2 * * *' # Run at 2 AM UTC daily
14+
15+
env:
16+
DOTNET_VERSION: '9.0.x'
17+
18+
jobs:
19+
validate-latest-release:
20+
name: Validate Latest Published Packages
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up .NET ${{ env.DOTNET_VERSION }}
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: ${{ env.DOTNET_VERSION }}
31+
32+
- name: Set up JDK 17
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: '17'
36+
distribution: 'temurin'
37+
38+
- name: Install Maven
39+
uses: stCarolas/setup-maven@v4
40+
with:
41+
maven-version: '3.9.6'
42+
43+
- name: Validate latest release packages
44+
shell: pwsh
45+
run: |
46+
$dockerTag = "${{ github.event.inputs.docker_tag }}"
47+
if ([string]::IsNullOrEmpty($dockerTag)) {
48+
$dockerTag = "latest"
49+
}
50+
51+
Write-Host "🧪 Validating latest release packages with Docker tag: $dockerTag"
52+
./ReleasePackagesTesting/validate-latest-release.ps1 -DockerTag $dockerTag
53+
54+
- name: Report validation results
55+
if: always()
56+
run: |
57+
if [ $? -eq 0 ]; then
58+
echo "✅ Latest release packages validated successfully"
59+
else
60+
echo "❌ Latest release packages validation failed"
61+
echo "::error::Published packages on NuGet.org and Docker Hub are incompatible"
62+
exit 1
63+
fi
64+
65+
- name: Create issue on failure
66+
if: failure() && github.event_name == 'schedule'
67+
uses: actions/github-script@v7
68+
with:
69+
script: |
70+
const title = '⚠️ Latest Release Packages Validation Failed';
71+
const body = `# Latest Release Packages Validation Failed
72+
73+
The automated validation of the latest published packages has failed.
74+
75+
## Details
76+
- **Workflow**: ${context.workflow}
77+
- **Run**: ${context.runId}
78+
- **Date**: ${new Date().toISOString()}
79+
80+
## What This Means
81+
The latest versions of:
82+
- FlinkDotnet package on NuGet.org
83+
- flinkdotnet/jobgateway Docker image on Docker Hub
84+
85+
Are not compatible with each other or have integration issues.
86+
87+
## Action Required
88+
1. Review the workflow logs: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}
89+
2. Investigate the compatibility issue
90+
3. Consider releasing a hotfix if the issue is critical
91+
92+
## Automated Check
93+
This issue was created automatically by the scheduled validation workflow.`;
94+
95+
// Check if issue already exists
96+
const issues = await github.rest.issues.listForRepo({
97+
owner: context.repo.owner,
98+
repo: context.repo.repo,
99+
state: 'open',
100+
labels: 'release-validation-failed'
101+
});
102+
103+
if (issues.data.length === 0) {
104+
await github.rest.issues.create({
105+
owner: context.repo.owner,
106+
repo: context.repo.repo,
107+
title: title,
108+
body: body,
109+
labels: ['bug', 'release-validation-failed', 'high-priority']
110+
});
111+
}

ReleasePackagesTesting/README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release Packages Testing
22

3-
This folder validates release packages before publishing to NuGet.org and Docker Hub.
3+
This folder validates release packages before and after publishing to NuGet.org and Docker Hub.
44

55
## Purpose
66

@@ -16,7 +16,9 @@ Tests the actual release artifacts to ensure they work correctly:
1616

1717
## Usage
1818

19-
Run from release workflows after building packages and Docker image:
19+
### Pre-Release Validation
20+
21+
Run from release workflows after building packages and Docker image (before publishing):
2022

2123
```bash
2224
# Load Docker image
@@ -29,8 +31,32 @@ dotnet nuget add source ./packages --name LocalFeed
2931
dotnet test ReleasePackagesTesting/ReleasePackagesTesting.sln
3032
```
3133

34+
Or use the automated script:
35+
36+
```bash
37+
./ReleasePackagesTesting/test-release-packages.ps1 -Version 1.0.0
38+
```
39+
40+
### Post-Release Validation
41+
42+
Run after publishing to verify latest packages work together:
43+
44+
```bash
45+
# Validates latest published packages from NuGet.org and Docker Hub
46+
./ReleasePackagesTesting/validate-latest-release.ps1
47+
48+
# Or test a specific Docker tag
49+
./ReleasePackagesTesting/validate-latest-release.ps1 -DockerTag "1.0.0"
50+
```
51+
52+
This ensures:
53+
- Latest FlinkDotnet package on NuGet.org
54+
- Latest flinkdotnet/jobgateway image on Docker Hub
55+
- Both packages work together correctly
56+
3257
## Validation
3358

3459
- All tests must pass before publishing to NuGet.org
3560
- Validates Docker image works with Flink cluster
3661
- Validates NuGet packages have correct dependencies
62+
- Post-release validation ensures published packages are compatible
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/usr/bin/env pwsh
2+
# Validates that the latest published packages work together
3+
# This ensures the latest release on NuGet.org and Docker Hub are compatible
4+
# Usage: ./validate-latest-release.ps1
5+
6+
param(
7+
[Parameter(Mandatory=$false)]
8+
[string]$DockerTag = "latest"
9+
)
10+
11+
$ErrorActionPreference = "Stop"
12+
13+
Write-Host "🧪 Validating Latest Release Packages" -ForegroundColor Cyan
14+
Write-Host "======================================" -ForegroundColor Cyan
15+
Write-Host "This validates that the latest published packages work together:" -ForegroundColor Yellow
16+
Write-Host " - NuGet.org: FlinkDotnet (latest)" -ForegroundColor Yellow
17+
Write-Host " - Docker Hub: flinkdotnet/jobgateway:$DockerTag" -ForegroundColor Yellow
18+
Write-Host ""
19+
20+
# Step 1: Remove any local NuGet feed
21+
Write-Host "📦 Step 1: Cleaning up local NuGet sources..." -ForegroundColor Yellow
22+
dotnet nuget remove source LocalFeed 2>$null
23+
Write-Host "✅ Local sources cleaned" -ForegroundColor Green
24+
25+
# Step 2: Ensure we're using the latest from NuGet.org
26+
Write-Host "`n📦 Step 2: Configuring to use NuGet.org..." -ForegroundColor Yellow
27+
# Update the csproj to NOT use conditional reference
28+
$csprojPath = "./ReleasePackagesTesting/ReleasePackagesTesting.IntegrationTests/ReleasePackagesTesting.IntegrationTests.csproj"
29+
$csprojContent = Get-Content $csprojPath -Raw
30+
31+
# Temporarily enable the package reference for this test
32+
$updatedContent = $csprojContent -replace 'PackageReference Include="FlinkDotnet" Version="\*" Condition="\$\(UseReleasePackages\)" == ''true''"', 'PackageReference Include="FlinkDotnet" Version="*"'
33+
34+
# Create a temporary csproj for this test
35+
$tempCsprojPath = "./ReleasePackagesTesting/ReleasePackagesTesting.IntegrationTests/ReleasePackagesTesting.IntegrationTests.csproj.temp"
36+
$updatedContent | Set-Content $tempCsprojPath
37+
Copy-Item $tempCsprojPath $csprojPath -Force
38+
Remove-Item $tempCsprojPath
39+
40+
Write-Host "✅ Configured to use NuGet.org" -ForegroundColor Green
41+
42+
# Step 3: Pull latest Docker image
43+
Write-Host "`n📦 Step 3: Pulling latest Docker image from Docker Hub..." -ForegroundColor Yellow
44+
Write-Host "Pulling flinkdotnet/jobgateway:$DockerTag..."
45+
docker pull flinkdotnet/jobgateway:$DockerTag
46+
if ($LASTEXITCODE -ne 0) {
47+
Write-Host "❌ Failed to pull Docker image" -ForegroundColor Red
48+
Write-Host " Make sure the image exists on Docker Hub" -ForegroundColor Yellow
49+
exit 1
50+
}
51+
Write-Host "✅ Docker image pulled successfully" -ForegroundColor Green
52+
53+
# Step 4: Tag it as latest for the test
54+
if ($DockerTag -ne "latest") {
55+
Write-Host "`n📦 Tagging image as latest for compatibility..." -ForegroundColor Yellow
56+
docker tag flinkdotnet/jobgateway:$DockerTag flinkdotnet/jobgateway:latest
57+
Write-Host "✅ Image tagged" -ForegroundColor Green
58+
}
59+
60+
# Step 5: Restore packages from NuGet.org
61+
Write-Host "`n📦 Step 4: Restoring packages from NuGet.org..." -ForegroundColor Yellow
62+
Push-Location ReleasePackagesTesting
63+
64+
# Clear local package cache to force download from NuGet.org
65+
Write-Host "Clearing local package cache for FlinkDotnet..."
66+
dotnet nuget locals all --clear
67+
68+
dotnet restore
69+
if ($LASTEXITCODE -ne 0) {
70+
Pop-Location
71+
Write-Host "❌ Failed to restore packages from NuGet.org" -ForegroundColor Red
72+
Write-Host " Make sure FlinkDotnet package is published on NuGet.org" -ForegroundColor Yellow
73+
exit 1
74+
}
75+
Write-Host "✅ Packages restored from NuGet.org" -ForegroundColor Green
76+
77+
# Step 6: Build solution
78+
Write-Host "`n📦 Step 5: Building solution..." -ForegroundColor Yellow
79+
dotnet build --configuration Release --no-restore
80+
if ($LASTEXITCODE -ne 0) {
81+
Pop-Location
82+
Write-Host "❌ Build failed" -ForegroundColor Red
83+
exit 1
84+
}
85+
Write-Host "✅ Build successful" -ForegroundColor Green
86+
87+
# Step 7: Run tests
88+
Write-Host "`n📦 Step 6: Running integration tests..." -ForegroundColor Yellow
89+
Write-Host "Testing that NuGet package and Docker image work together..." -ForegroundColor Yellow
90+
dotnet test --configuration Release --no-build --verbosity normal
91+
$testResult = $LASTEXITCODE
92+
Pop-Location
93+
94+
if ($testResult -ne 0) {
95+
Write-Host "`n❌ Tests FAILED - Latest release packages have compatibility issues!" -ForegroundColor Red
96+
Write-Host " This indicates the published packages on NuGet.org and Docker Hub are incompatible" -ForegroundColor Yellow
97+
exit 1
98+
}
99+
100+
Write-Host "`n✅ All tests PASSED - Latest release packages work correctly together!" -ForegroundColor Green
101+
Write-Host "======================================" -ForegroundColor Cyan
102+
Write-Host "✅ Latest release validation complete" -ForegroundColor Cyan
103+
Write-Host ""
104+
Write-Host "Validated packages:" -ForegroundColor Green
105+
Write-Host " - FlinkDotnet from NuGet.org (latest)" -ForegroundColor Green
106+
Write-Host " - flinkdotnet/jobgateway:$DockerTag from Docker Hub" -ForegroundColor Green
107+
108+
exit 0

0 commit comments

Comments
 (0)