Skip to content

fix: deduplicate charm artefacts in publish workflow#973

Closed
cbartz wants to merge 4 commits intomainfrom
fix/deduplicate-charm-artifacts
Closed

fix: deduplicate charm artefacts in publish workflow#973
cbartz wants to merge 4 commits intomainfrom
fix/deduplicate-charm-artifacts

Conversation

@cbartz
Copy link
Copy Markdown
Contributor

@cbartz cbartz commented Mar 17, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mergeCharmBuilds function into src/utils.ts, deduplicating charm builds by name instead of output
  • Replaced inline merge logic in src/get-plan.ts with a call to the new utility function
  • Rebuilt dist bundles (includes upstream @actions/artifact dependency 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>
@weiiwang01
Copy link
Copy Markdown
Collaborator

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.

#963

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:17:00.023823+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:17:00.417797+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:19:00.957667+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:17:00.023823+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:17:00.417797+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 0aba0fd

Test coverage for 0aba0fd

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py       8      8      0      0     0%   8-25
----------------------------------------------------------
TOTAL              8      8      0      0     0%

Static code analysis report

Run started:2026-03-17 12:19:00.957667+00:00

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 56
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@cbartz
Copy link
Copy Markdown
Contributor Author

cbartz commented Mar 18, 2026

closing in favor of #974

@cbartz cbartz closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants