fix: deduplicate charm artefacts in publish workflow#973
fix: deduplicate charm artefacts in publish workflow#973
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes duplicate charm publishing by extracting the merge logic into a dedicated mergeCharmBuilds utility function and changing the deduplication key from output (artifact name, which includes a unique plan ID prefix) to name (the charm's actual name). Previously, identical charms built across multiple integration test runs had different output values due to different plan IDs, causing them to bypass deduplication and be published multiple times.
Changes:
- Extracted
mergeCharmBuildsfunction intosrc/utils.ts, deduplicating charm builds bynameinstead ofoutput - Replaced inline merge logic in
src/get-plan.tswith a call to the new utility function - Rebuilt dist bundles (includes upstream
@actions/artifactdependency bump from 6.2.0 to 6.2.1)
Reviewed changes
Copilot reviewed 2 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils.ts | New mergeCharmBuilds function that deduplicates charm builds by name |
| src/get-plan.ts | Replaced inline merge logic with call to mergeCharmBuilds |
| dist/get-plan/index.js | Rebuilt dist bundle reflecting source changes |
| dist/publish/index.js | Rebuilt dist bundle (dependency bump only) |
| dist/plan/index.js | Rebuilt dist bundle (dependency bump only) |
| dist/plan-scan/index.js | Rebuilt dist bundle (dependency bump only) |
| dist/plan-integration/index.js | Rebuilt dist bundle (dependency bump only) |
| dist/build/index.js | Rebuilt dist bundle (dependency bump only) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
I fear this change defeats the purpose of this pull request, which is to allow publishing charms for different architectures. I think maybe you can deduplicate at this step based on the charm file name, since charms for different architectures have different file names. |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
Test results for commit 0aba0fdTest coverage for 0aba0fd Static code analysis report |
|
closing in favor of #974 |
Overview
Avoid publishing the same charm multiple times.
Rationale
We have a repository where we run build charm 4 times in integration test. Every build charm step creates 2 artefacts/charms. These are identical across the other build charm steps. The code does publish 8 revisions instead of 2.
https://github.com/canonical/github-runner-operator/actions/runs/23185415556/job/67367595863#step:7:1
Workflow Changes
Checklist
urgent,trivial,complex)