Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
6f6924f
chore: add --version flag to support version check
ligangty Dec 17, 2024
23b1026
Merge pull request #289 from ligangty/ver
ligangty Dec 17, 2024
b7f3d53
Fix mmeng-4362: re-sort the indexing page items
ligangty May 9, 2025
955f1ba
Merge pull request #292 from ligangty/mmeng-4362
ligangty May 9, 2025
6578fea
Fix pip warning: add pyproject.toml
ligangty May 12, 2025
ae19c1b
Merge pull request #293 from ligangty/prjtoml
ligangty May 12, 2025
54aeae8
RADAS: add radas configurations
ligangty Apr 28, 2025
460bfe3
Merge pull request #295 from ligangty/radas-cfg
ligangty May 14, 2025
e322b4e
Feat: Support to accept the response of signing result from RADAS
yma955 May 13, 2025
07e43f3
Format Code and fix typo
yma955 May 13, 2025
42dbb01
Rename radas_sign_timeout_retry_count and radas_sign_timeout_retry_in…
yma955 May 19, 2025
89be82f
Use oras registry_config and registry url parse to finalize login
yma955 May 19, 2025
d4eee68
Change sign_result_loc to cmd flag both for sign request and maven up…
yma955 May 20, 2025
d2e86c9
Update quay_radas_registry_config to default None since it's not nece…
yma955 May 20, 2025
75740e5
Use radas_config validate instead of is_radas_config_enable option
yma955 May 20, 2025
947f23c
Ignore the registry config if the provided config path is not valid t…
yma955 May 20, 2025
da803dd
Add is_radas_enabled unified method to check radas enablement
yma955 May 20, 2025
f784b16
Change on_message process method without using threads
yma955 May 21, 2025
57ae222
RADAS: Add sign command skeleton
ligangty Apr 28, 2025
83a92f9
Remove timeout retry handling for sign result fetch from maven upload
yma955 May 21, 2025
23a4dc8
Merge pull request #296 from ligangty/radas-cmd
ligangty May 22, 2025
cfdd37f
Merge pull request #294 from yma96/main
yma955 May 22, 2025
f90557c
Some changes on sign cmd and config
yma955 May 21, 2025
48ec92a
Merge pull request #298 from ligangty/radas-cmd
ligangty May 26, 2025
9f0073f
Fix: add back the radas_config type for mypy check
ligangty May 26, 2025
ae5ec19
Merge pull request #299 from ligangty/radas-cmd
ligangty May 26, 2025
730ae43
Add Unit tests for RADAS signing results parse and generation
yma955 May 27, 2025
1102798
Change 'result' to 'results' ref signing/radas-nonprod test samples
yma955 May 27, 2025
229f448
Add request_id match logic for radas message receiver
yma955 May 28, 2025
8dff820
Merge pull request #300 from yma96/main
yma955 May 28, 2025
bf01903
Merge pull request #301 from yma96/add-request-id
yma955 May 29, 2025
2672bb3
Add sign response status and errors for receiver then use to control …
yma955 May 29, 2025
1921e41
Merge pull request #302 from yma96/main
yma955 May 29, 2025
c7ebf31
Feature of send radas sign request and unit test for it
shokakucarrier May 29, 2025
08fe405
Merge pull request #297 from shokakucarrier/main
ligangty May 30, 2025
678606b
Refactor: refactor the RadasSender
ligangty May 30, 2025
6949e52
Merge pull request #303 from ligangty/radas-umb
ligangty Jun 4, 2025
5cff6d4
Refactor: Refactor the RadasReceiver
ligangty Jun 5, 2025
3aa77c7
Merge pull request #304 from ligangty/radas-umb
ligangty Jun 5, 2025
6340f91
Some chore changes:
ligangty Jun 5, 2025
268d002
Merge pull request #305 from ligangty/radas-umb
ligangty Jun 5, 2025
3278f22
RADAS: change the request_queue to request_channel in config
ligangty Jun 5, 2025
372e222
Merge pull request #306 from ligangty/radas-umb
ligangty Jun 5, 2025
3e71875
Add missing oras deps in project.toml and setup.py
ligangty Jun 6, 2025
7240d17
Merge pull request #307 from ligangty/radas-umb
ligangty Jun 6, 2025
a38e565
RADAS: update Containerfile for radas support
ligangty Jun 9, 2025
e32526b
Merge pull request #309 from ligangty/radas-umb
ligangty Jun 9, 2025
83e8bca
RADAS: add default ignore patterns for signing
ligangty Jun 9, 2025
821599b
Update project version to 1.4.0
ligangty Jun 11, 2025
f60f2ce
Merge pull request #310 from ligangty/radas-umb
ligangty Jun 11, 2025
d0d8d12
RADAS: use result file directly instead of folder in maven upload
ligangty Jun 11, 2025
5720473
Merge pull request #311 from ligangty/radas-umb
ligangty Jun 11, 2025
59a6290
RADAS: Added some log
ligangty Jun 12, 2025
f79eb0d
Merge pull request #315 from ligangty/radas-umb
ligangty Jun 12, 2025
539b79d
RADAS: adjust some logging
ligangty Jun 12, 2025
19a9b5c
Merge pull request #316 from ligangty/radas-umb
ligangty Jun 12, 2025
8f47855
RADAS: fix radas response format
ligangty Jun 13, 2025
77d8545
Merge pull request #317 from ligangty/radas-umb
ligangty Jun 13, 2025
187f1ed
control oras version under 0.2.31 to make it be compatible with pytho…
ligangty Jun 23, 2025
f7ac5e2
Merge pull request #322 from ligangty/main
ligangty Jun 23, 2025
22009bf
RADAS: fix a flag typo in upload for radas signing
ligangty Jun 25, 2025
0c17fe3
Merge pull request #327 from ligangty/radas-umb
ligangty Jun 25, 2025
b7ec978
Chore: RADAS: some logging adjustment
ligangty Jun 26, 2025
c7c0190
Merge pull request #328 from ligangty/radas-umb
ligangty Jun 26, 2025
a9bcb5f
Fix: RADAS: fix a list index out of bounds issue
ligangty Jun 26, 2025
1dc15a6
Merge pull request #329 from ligangty/radas-umb
ligangty Jun 26, 2025
cb22011
Chore: some little adjustment
ligangty Jul 16, 2025
ce29856
Merge pull request #337 from ligangty/main
ligangty Jul 16, 2025
8ae1861
Chore: replace all file write with files.overwrite_file
ligangty Jun 25, 2025
ecb5724
Feat: support recursive indexing for index function
ligangty Jul 9, 2025
cc52352
Fix a issue of pyproject.toml file
ligangty Sep 19, 2025
a0fb775
Merge pull request #344 from ligangty/1.3.x
ligangty Sep 19, 2025
308f53a
Some fix for setup tools
ligangty Sep 19, 2025
70ac593
Merge pull request #345 from ligangty/1.3.x
ligangty Sep 19, 2025
1952912
Fix a issue of pyproject.toml file
ligangty Sep 19, 2025
8ad7932
Some fix for setup tools
ligangty Sep 19, 2025
02ebe2a
Merge pull request #346 from ligangty/main
ligangty Sep 19, 2025
00e7e19
Fix pyproject.toml license issue
ligangty Sep 19, 2025
cd42d1f
Merge pull request #347 from ligangty/1.3.x
ligangty Sep 19, 2025
d673970
Fix pyproject.toml license issue
ligangty Sep 19, 2025
d190477
Merge pull request #348 from ligangty/main
ligangty Sep 19, 2025
29594e5
Feat: Accept multiple maven zips with non-RADAS signing way
yma955 Oct 13, 2025
6d4dc56
Fix TypeError for argument multi nargs value defination
yma955 Oct 14, 2025
f3a2c55
Fix note, err log, repos param list type, merged dir name length, typ…
yma955 Oct 17, 2025
45d3210
Fix files duplicated logic for the merge overlapping case
yma955 Oct 22, 2025
cd7ed7a
Add archetype catalog files merged logic for merged zips
yma955 Oct 22, 2025
56c5a33
Fix unnecessary file open during archetype catalog merge
yma955 Oct 23, 2025
d927796
Merge pull request #350 from yma96/1.3.x
yma955 Oct 23, 2025
9afe959
Fix: remove two redundant open operations
ligangty Oct 23, 2025
ea975d3
Merge pull request #352 from ligangty/1.3.x
ligangty Oct 23, 2025
adf8ab1
Merge branch '1.3.x'
ligangty Oct 29, 2025
46cf0c5
Update version to 1.3.5
ligangty Oct 29, 2025
9d18501
Merge pull request #354 from ligangty/main
ligangty Oct 29, 2025
21421a8
Merge pull request #355 from ligangty/1.3.x
ligangty Oct 29, 2025
57f7413
Update charon.spec for release notes
ligangty Oct 29, 2025
1dad879
Update README
ligangty Oct 29, 2025
91005ca
Merge pull request #356 from ligangty/1.3.x
ligangty Oct 29, 2025
6259383
Merge branch '1.3.x'
ligangty Oct 29, 2025
49a67e1
Merge pull request #357 from ligangty/main
ligangty Oct 29, 2025
9113f1e
Fix some potential security issues
ligangty Nov 26, 2025
5c47930
Merge pull request #361 from ligangty/1.3.x
ligangty Nov 27, 2025
58a33d1
Merge branch '1.3.x'
ligangty Nov 29, 2025
4a96f1f
Fix tests issue with new merged code from 1.3.x
ligangty Nov 29, 2025
e51048c
Merge pull request #363 from ligangty/main
ligangty Nov 29, 2025
10ed3a8
Feat: Add merge cmd for multiple maven zips
yma955 Nov 19, 2025
0a32943
Update the param merge_result note about default value description
yma955 Nov 26, 2025
dbf1785
Merge pull request #360 from yma955/main
yma955 Dec 1, 2025
d896e27
Upgrade pytest to 9.0.1
ligangty Dec 1, 2025
97824d8
Merge pull request #364 from ligangty/main
ligangty Dec 1, 2025
cd18d27
Merge branch 'main' into release
ligangty Dec 1, 2025
392ab6f
Fix a spec file issue
ligangty Dec 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include LICENSE
include README.md
include pyproject.toml
include setup.py
recursive-include charon *.py *.json
recursive-include tests *.py *.txt *.tgz *.zip *.json *.sha1
exclude .github .gitignore

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ to configure AWS access credentials.
### charon-upload: upload a repo to S3

```bash
usage: charon upload $tarball --product/-p ${prod} --version/-v ${ver} [--root_path] [--ignore_patterns] [--debug] [--contain_signature] [--key]
usage: charon upload $tarball [$tarball*] --product/-p ${prod} --version/-v ${ver} [--root_path] [--ignore_patterns] [--debug] [--contain_signature] [--key]
```

This command will upload the repo in tarball to S3.
It will auto-detect if the tarball is for maven or npm

**New in 1.3.5**: For Maven archives, this command now supports uploading multiple zip files at once. When multiple Maven zips are provided, they will be merged intelligently, including proper handling of archetype catalog files and duplicate artifact detection.

* For maven type, it will:

* Scan the tarball for all paths and collect them all.
Expand Down Expand Up @@ -99,11 +101,13 @@ This command will delete some paths from repo in S3.
### charon-index: refresh the index.html for the specified path

```bash
usage: charon index $PATH [-t, --target] [-D, --debug] [-q, --quiet]
usage: charon index $PATH [-t, --target] [-D, --debug] [-q, --quiet] [--recursive]
```

This command will refresh the index.html for the specified path.

**New in 1.3.5**: Added `--recursive` flag to support recursive indexing under the specified path.

* Note that if the path is a NPM metadata path which contains package.json, this refreshment will not work because this type of folder will display the package.json instead of the index.html in http request.

### charon-cf-check: check the invalidation status of the specified invalidation id for AWS CloudFront
Expand Down
16 changes: 11 additions & 5 deletions charon.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,28 @@ export LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8


%changelog
* Wed Oct 29 2025 Gang Li <gli@redhat.com>
- 1.3.5 release
- Support recursive indexing for index function
- Accept multiple maven zips for uploading

* Fri Jun 27 2025 Gang Li <gli@redhat.com>
- 1.4.0 release
- Add RADAS signature support

* Mon Jun 23 2025 Gang Li <gli@redhat.com>
- 1.3.4 release
- Fix the sorting problem of index page items
- Add --version flag to support version check
- Bug fix: MMENG-4362 re-sort the indexing page items
- Add pyproject.toml

* Mon Dec 16 2024 Gang Li <gli@redhat.com>
- 1.3.3 release
- Fix npm del error when deleting a package which has overlapped name with others
- Some code refinement
- Bug fix: MMENG-4284 npm del error when deleting a package which has overlapped name with others

* Thu Jul 11 2024 Gang Li <gli@redhat.com>
* Wed Jul 10 2024 Gang Li <gli@redhat.com>
- 1.3.2 release
- Some updates in the Containerfile.
- Container file update

* Tue May 7 2024 Gang Li <gli@redhat.com>
- 1.3.1 release
Expand Down
4 changes: 2 additions & 2 deletions charon/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def invalidate_paths(
The default value is 3000 which is the maximum number in official doc:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#InvalidationLimits
"""
INPRO_W_SECS = 5
NEXT_W_SECS = 1
INPRO_W_SECS = 10
NEXT_W_SECS = 2
real_paths = [paths]
# Split paths into batches by batch_size
if batch_size:
Expand Down
4 changes: 4 additions & 0 deletions charon/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from charon.cmd.cmd_checksum import init_checksum, checksum
from charon.cmd.cmd_cache import init_cf, cf
from charon.cmd.cmd_sign import sign
from charon.cmd.cmd_merge import merge


@group()
Expand Down Expand Up @@ -47,3 +48,6 @@ def cli(ctx):

# radas sign cmd
cli.add_command(sign)

# maven zips merge cmd
cli.add_command(merge)
18 changes: 17 additions & 1 deletion charon/cmd/cmd_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
""",
required=True
)
@option(
"--recursive",
"-r",
help="If do indexing recursively under $path",
is_flag=True,
default=False
)
@option(
"--config",
"-c",
Expand Down Expand Up @@ -69,6 +76,7 @@
def index(
path: str,
target: str,
recursive: bool = False,
config: str = None,
debug: bool = False,
quiet: bool = False,
Expand Down Expand Up @@ -120,7 +128,15 @@ def index(
if not aws_bucket:
logger.error("No bucket specified for target %s!", target)
else:
re_index(b, path, package_type, aws_profile, dryrun)
args = {
"target": b,
"path": path,
"package_type": package_type,
"aws_profile": aws_profile,
"recursive": recursive,
"dry_run": dryrun
}
re_index(**args) # type: ignore

except Exception:
print(traceback.format_exc())
Expand Down
156 changes: 156 additions & 0 deletions charon/cmd/cmd_merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
"""
Copyright (C) 2022 Red Hat, Inc. (https://github.com/Commonjava/charon)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from typing import List

from charon.utils.archive import detect_npm_archives, NpmArchiveType
from charon.cmd.internal import _get_local_repos, _decide_mode
from charon.pkgs.maven import _extract_tarballs
from click import command, option, argument
from zipfile import ZipFile, ZIP_DEFLATED
from tempfile import mkdtemp

import logging
import os
import sys

logger = logging.getLogger(__name__)


@argument(
"repos",
type=str,
nargs=-1 # This allows multiple arguments for zip urls
)
@option(
"--product",
"-p",
help="""
The product key, will combine with version to decide
the metadata of the files in tarball.
""",
nargs=1,
required=True,
multiple=False,
)
@option(
"--version",
"-v",
help="""
The product version, will combine with key to decide
the metadata of the files in tarball.
""",
required=True,
multiple=False,
)
@option(
"--root_path",
"-r",
default="maven-repository",
help="""
The root path in the tarball before the real maven paths,
will be trailing off before uploading.
""",
)
@option(
"--work_dir",
"-w",
help="""
The temporary working directory into which archives should
be extracted, when needed.
""",
)
@option(
"--merge_result",
"-m",
help="""
The path of the final merged zip file will be compressed and saved.
Default is the ZIP file which is created in a temporary directory based on work_dir.
e.g. /tmp/work/jboss-eap-8.1.0_merged_a1b2c3/jboss-eap-8.1.0_merged.zip
""",
)
@option(
"--debug",
"-D",
help="Debug mode, will print all debug logs for problem tracking.",
is_flag=True,
default=False
)
@option(
"--quiet",
"-q",
help="Quiet mode, will shrink most of the logs except warning and errors.",
is_flag=True,
default=False
)
@command()
def merge(
repos: List[str],
product: str,
version: str,
root_path="maven-repository",
work_dir=None,
merge_result=None,
debug=False,
quiet=False
):
"""Merge multiple Maven ZIP archives and compress the result into a single ZIP file.
The merged file is stored locally as specified by merge_result.

Note: This function does not support merging single archive, NPM archives,
or archives of inconsistent types.
"""
_decide_mode(product, version, is_quiet=quiet, is_debug=debug)
if len(repos) == 1:
logger.info("Skip merge step, single archive detected, no merge needed")
sys.exit(0)

product_key = f"{product}-{version}"
archive_paths = _get_local_repos(repos)
archive_types = detect_npm_archives(archive_paths)

maven_count = archive_types.count(NpmArchiveType.NOT_NPM)
npm_count = len(archive_types) - maven_count
if maven_count == len(archive_types):
tmp_root = _extract_tarballs(archive_paths, root_path, product_key, dir__=work_dir)
_create_merged_zip(tmp_root, merge_result, product_key, work_dir)
elif npm_count == len(archive_types):
logger.error("Skip merge step for the npm archives")
sys.exit(1)
else:
logger.error("Skip merge step since the types are not consistent")
sys.exit(1)


def _create_merged_zip(
root_path: str,
merge_result: str,
product_key: str,
work_dir: str
):
zip_path = merge_result
if not merge_result:
merge_path = mkdtemp(prefix=f"{product_key}_merged_", dir=work_dir)
zip_path = os.path.join(merge_path, f"{product_key}_merged.zip")

# pylint: disable=unused-variable
with ZipFile(zip_path, 'w', ZIP_DEFLATED) as zipf:
for root, dirs, files in os.walk(root_path):
for file in files:
file_path = os.path.join(root, file)
# Calculate relative path to preserve directory structure
arcname = os.path.relpath(file_path, root_path)
zipf.write(file_path, arcname)
logger.info("Done for the merged zip generation: %s", zip_path)
Loading