Skip to content

feat(RELEASE-2509): add python scripts for publish-to-nrrc task#804

Open
elenagerman wants to merge 1 commit into
konflux-ci:mainfrom
elenagerman:release-2509
Open

feat(RELEASE-2509): add python scripts for publish-to-nrrc task#804
elenagerman wants to merge 1 commit into
konflux-ci:mainfrom
elenagerman:release-2509

Conversation

@elenagerman

@elenagerman elenagerman commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

Moves the prepare-repo and upload-npm-archive logic from inline Tekton bash into standalone Python scripts under scripts/python/tasks/managed/, with Tekton parameters passed as CLI flags.
It adds a small charon_env helper for parsing charon parameter files, reuses the existing subprocess_cmd helper from create_advisory, and bundles the charon CLI into the utils image so both steps can run from release-service-utils.

Relevant Jira

RELEASE-2509

Assisted-by: Claude

@elenagerman elenagerman marked this pull request as draft June 3, 2026 14:13
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add Python scripts for publish-to-nrrc task with charon integration

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add Python scripts for publish-to-nrrc task replacing inline Tekton bash
• Implement charon environment file parser with registry and digest utilities
• Create prepare-repo script to download npm archives from OCI registries
• Create upload script to publish archives to NRRC via charon CLI
• Bundle charon CLI and dependencies into release-service-utils image
Diagram
flowchart LR
  A["Tekton Task"] -->|CLI flags| B["prepare_repo.py"]
  B -->|parse| C["charon_env.py"]
  C -->|registry list| B
  B -->|oras pull| D["OCI Registry"]
  D -->|archives| B
  B -->|collect| E["shared/"]
  A -->|CLI flags| F["upload.py"]
  F -->|parse| C
  C -->|config| F
  F -->|charon upload| G["NRRC"]
  E -->|archives| F

Loading

Grey Divider

File Changes

1. scripts/python/helpers/charon_env.py ✨ Enhancement +48/-0

Charon environment file parsing utilities

• Parse charon .env files containing export KEY=value lines
• Split OCI registry references on % delimiter
• Extract short SHA256 digest prefix and repository from registry references

scripts/python/helpers/charon_env.py


2. scripts/python/helpers/test_charon_env.py 🧪 Tests +63/-0

Tests for charon environment utilities

• Test parsing of export lines with quoted values
• Test handling of missing files and malformed lines
• Test registry splitting, digest extraction, and repository parsing

scripts/python/helpers/test_charon_env.py


3. scripts/python/tasks/managed/publish_to_nrrc_prepare_repo.py ✨ Enhancement +129/-0

Prepare repository script for npm archives

• Download npm archives from OCI registries using oras pull
• Collect gzip/tar files into shared directory with hash prefixes
• Handle authentication via select-oci-auth and temporary auth files
• Skip non-archive files and warn on duplicate filenames

scripts/python/tasks/managed/publish_to_nrrc_prepare_repo.py


View more (5)
4. scripts/python/tasks/managed/test_publish_to_nrrc_prepare_repo.py 🧪 Tests +253/-0

Tests for prepare-repo script

• Test downloading and collecting archives from single registry
• Test handling of multiple %-separated registries
• Test skipping of non-archive files and duplicate filenames
• Test validation of required CHARON_OCI_REGISTRY parameter

scripts/python/tasks/managed/test_publish_to_nrrc_prepare_repo.py


5. scripts/python/tasks/managed/publish_to_nrrc_upload.py ✨ Enhancement +115/-0

Upload script for NRRC publishing

• Upload prepared npm archives to NRRC using charon CLI
• Install charon configuration into charon home directory
• Extract product name, version, and target from charon env file
• Execute charon upload command for each archive file

scripts/python/tasks/managed/publish_to_nrrc_upload.py


6. scripts/python/tasks/managed/test_publish_to_nrrc_upload.py 🧪 Tests +146/-0

Tests for upload script

• Test charon config installation into home directory
• Test charon upload invocation for each archive file
• Test validation of required charon env variables
• Test error handling for missing archives and config files

scripts/python/tasks/managed/test_publish_to_nrrc_upload.py


7. Dockerfile ⚙️ Configuration changes +7/-1

Bundle charon CLI into utils image

• Add charon base image stage for building release-service-utils
• Copy charon binary and Python dependencies into final image
• Include charon, subresource_integrity, and semantic_version packages

Dockerfile


8. pyproject.toml ⚙️ Configuration changes +1/-0

Update pytest path configuration

• Add scripts/python/tasks/managed to pytest pythonpath configuration

pyproject.toml


Grey Divider

Qodo Logo

@qodo-code-review

This comment was marked as resolved.

Comment thread scripts/python/tasks/managed/test_publish_to_nrrc_prepare_repo.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc_prepare_repo.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc_upload.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc_prepare_repo.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc_upload.py Outdated
@elenagerman elenagerman force-pushed the release-2509 branch 2 times, most recently from 8d6d49c to 38e3029 Compare June 3, 2026 15:32
@codecov-commenter

codecov-commenter commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.72%. Comparing base (86975a4) to head (8d39e40).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #804      +/-   ##
==========================================
+ Coverage   95.65%   95.72%   +0.06%     
==========================================
  Files          72       74       +2     
  Lines        7118     7222     +104     
==========================================
+ Hits         6809     6913     +104     
  Misses        309      309              
Flag Coverage Δ
unit-tests 95.72% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/python/helpers/charon_env.py 100.00% <100.00%> (ø)
scripts/python/helpers/file.py 100.00% <100.00%> (ø)
scripts/python/tasks/managed/publish_to_nrrc.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86975a4...8d39e40. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman elenagerman force-pushed the release-2509 branch 4 times, most recently from bd25062 to 85e5af2 Compare June 4, 2026 14:23
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman elenagerman force-pushed the release-2509 branch 2 times, most recently from c517947 to d875598 Compare June 4, 2026 19:31
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman elenagerman force-pushed the release-2509 branch 3 times, most recently from 5efc452 to df70910 Compare June 8, 2026 12:57
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

mmalina
mmalina previously approved these changes Jun 26, 2026

@johnbieren johnbieren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm confused by this PR. We have talked about how when we convert to python, we want to go from multi step to single step in the tekton tasks. Here, I see the publish-to-nrrc task split into multi python scripts. Why? Also, if it isn't a managed task name, it shouldn't really be in tasks/managed it should be in helpers

Comment thread scripts/python/helpers/file.py Outdated
Comment thread scripts/python/helpers/charon_env.py
@elenagerman

Copy link
Copy Markdown
Contributor Author

I'm confused by this PR. We have talked about how when we convert to python, we want to go from multi step to single step in the tekton tasks. Here, I see the publish-to-nrrc task split into multi python scripts. Why? Also, if it isn't a managed task name, it shouldn't really be in tasks/managed it should be in helpers

Good questions!
you are right, the layout is confusing.
publish_to_nrrc_upload.py shouldn’t be there.
It was a leftover from an earlier attempt; removed for now.

  • agree: charon_env.py moved to helpers

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

Comment thread scripts/python/tasks/managed/publish_to_nrrc.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc.py Outdated
Comment thread scripts/python/tasks/managed/publish_to_nrrc.py
@elenagerman elenagerman force-pushed the release-2509 branch 3 times, most recently from c40f859 to 4f512a6 Compare June 29, 2026 22:10
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

@ach912 ach912 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

@ach912

ach912 commented Jul 1, 2026

Copy link
Copy Markdown

Production Approval Record

Field Value
Action APPROVED
Reviewer @ach912
Timestamp 2026-07-01T07:26:44.585Z

Approved

@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

add python scripts for publish-to-nrrc task

Signed-off-by: Elena German <elgerman@redhat.com>
Assisted-by: Claude
@elenagerman

Copy link
Copy Markdown
Contributor Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants