Skip to content

fix(publish charm): deduplicate charm artifacts in publish workflow#974

Open
yanksyoon wants to merge 4 commits intomainfrom
fix/deduplicate-artefacts
Open

fix(publish charm): deduplicate charm artifacts in publish workflow#974
yanksyoon wants to merge 4 commits intomainfrom
fix/deduplicate-artefacts

Conversation

@yanksyoon
Copy link
Copy Markdown
Member

Problem

Multiple integration test jobs can build identical charms that get uploaded as separate artifacts. The publish workflow downloads all these artifacts and processes them without deduplication, potentially causing issues with duplicate charm files.

For example, in run 23226829927, there are 4 identical charm artifacts from parallel test jobs that would all be processed.

Solution

Implemented content-based deduplication using SHA-256 hashing combined with basename. This ensures:

  • Identical charms (same name and content) are deduplicated
  • Legitimately different charms (e.g., different architectures like github-runner_amd64.charm and github-runner_arm64.charm) are preserved

Changes

  • Added crypto import for SHA-256 hashing
  • Implemented deduplication logic in getCharms() method that:
    • Computes SHA-256 hash of each charm file's content
    • Creates unique key from basename + hash
    • Keeps only one file per unique key
  • Regenerated dist files

Testing

  • ✅ Code builds successfully (npm run package)
  • ✅ Linter passes (npm run lint)

Multiple integration test jobs can build identical charms that get
uploaded as separate artifacts. Without deduplication, the publish
workflow would attempt to process all duplicate charm files.

Use SHA-256 hashing combined with basename to deduplicate charm files
that have both the same filename and identical content, while
preserving legitimately different charms (e.g., different architectures).
@yanksyoon yanksyoon requested a review from a team as a code owner March 18, 2026 04:57
@yanksyoon yanksyoon requested review from seb4stien and srbouffard and removed request for a team March 18, 2026 04:57
@yanksyoon yanksyoon changed the title fix: deduplicate charm artifacts in publish workflow fix(publish charm): deduplicate charm artifacts in publish workflow Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Test results for commit 8b8788e

Test coverage for 8b8788e

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-24 07:28:09.485998+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 8b8788e

Test coverage for 8b8788e

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-24 07:28:13.808590+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 8b8788e

Test coverage for 8b8788e

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-24 07:45:53.342840+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 8b8788e

Test coverage for 8b8788e

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-24 07:28:09.485998+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 8b8788e

Test coverage for 8b8788e

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-24 07:28:13.808590+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 8b8788e

Test coverage for 8b8788e

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-24 07:45:53.342840+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):

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.

4 participants