Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
225e4ed
Update the README
ligangty May 11, 2024
6e686a8
Merge pull request #225 from ligangty/main
ligangty May 11, 2024
57da84a
Mv Dockerfile to image folder and fix some issues
ligangty Jun 2, 2024
03f7542
Merge pull request #227 from ligangty/main
ligangty Jun 4, 2024
6101917
Add RH root CA to the image
ligangty Jun 4, 2024
7ce7a7f
Merge pull request #229 from ligangty/main
ligangty Jun 27, 2024
3cfde6c
Update Containerfile
ligangty Jul 4, 2024
7fd079a
Merge pull request #246 from ligangty/main
ligangty Jul 4, 2024
25e4363
Update Containerfile to use multi-stage build to reduce size
ligangty Jul 4, 2024
3097534
Merge pull request #247 from ligangty/main
ligangty Jul 4, 2024
074dcd4
Adjust requirements.txt
ligangty Jul 7, 2024
716587e
Merge pull request #249 from ligangty/main
ligangty Jul 7, 2024
e5596eb
Adjust requirements.txt - add lower version bounds
ligangty Jul 7, 2024
213d004
Merge pull request #250 from ligangty/main
ligangty Jul 7, 2024
1f53439
Add setuptools for pkg_resources module missing
ligangty Jul 8, 2024
89161e8
Merge pull request #251 from ligangty/deps
ligangty Jul 8, 2024
5733f93
Add dependencies in setup.py
ligangty Jul 8, 2024
97c2af1
Merge pull request #252 from ligangty/main
ligangty Jul 9, 2024
c56dab2
Update Containerfile to use pip wheel way to install
ligangty Jul 8, 2024
917d083
Merge pull request #253 from ligangty/deps
ligangty Jul 9, 2024
32dcf26
Remove ca update for RH-IT-Root as it is used internally
ligangty Jul 10, 2024
e800647
Merge pull request #254 from ligangty/main
ligangty Jul 10, 2024
dae5372
Update version to 1.3.2 in setup.py
ligangty Jul 10, 2024
4e3e186
Merge pull request #255 from ligangty/main
ligangty Jul 10, 2024
4294def
Merge branch 'main' into release
ligangty Jul 10, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ package/
.local
local
.DS_Store
*.whl


# Unit test
__pytest_reports
Expand Down
58 changes: 0 additions & 58 deletions Dockerfile

This file was deleted.

27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ This command will upload the repo in tarball to S3.
It will auto-detect if the tarball is for maven or npm

* For maven type, it will:

* Scan the tarball for all paths and collect them all.
* Check the existence in S3 for all those paths.
* Filter out the paths in tarball based on:
Expand All @@ -70,10 +71,8 @@ It will auto-detect if the tarball is for maven or npm
* Upload these artifacts to S3 with metadata of the product.
* If the artifacts already exists in S3, update the metadata
of the product by appending the new product.

* NPM type (TBH): We need to know the exact tarball structure
of npm repo

* For both types, after uploading the files, regenerate/refresh
the index files for these paths.

Expand Down Expand Up @@ -107,10 +106,30 @@ This command will refresh the index.html for 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-validate: validate the checksum of files in specified path in a maven repository
### charon-cf-check: check the invalidation status of the specified invalidation id for AWS CloudFront

```bash
usage: charon cf check $invalidation_id [-t, --target] [-D, --debug] [-q, --quiet]
```

### charon-cf-invalidate: do invalidating on AWS CloudFront for the specified paths

```bash
usage: charon cf invalidate [-t, --target] [-p, --path] [-f, --path-file] [-D, --debug] [-q, --quiet]
```

### charon-checksum-validate: validate the checksum of files in specified path in a maven repository

```bash
usage: charon validate $path [-t, --target] [-f, --report_file_path] [-i, --includes] [-r, --recursive] [-D, --debug] [-q, --quiet]
usage: charon checksum validate $path [-t, --target] [-f, --report_file_path] [-i, --includes] [-r, --recursive] [-D, --debug] [-q, --quiet]
```

This command will validate the checksum of the specified path for the maven repository. It will calculate the sha1 checksum of all artifact files in the specified path and compare with the companied .sha1 files of the artifacts, then record all mismatched artifacts in the report file. If some artifact files misses the companied .sha1 files, they will also be recorded.

### charon-checksum-refresh: refresh the checksum files for the artifacts in the specified maven repository

```bash
usage: charon checksum refresh [-t, --target] [-p, --path] [-f, --path-file] [-D, --debug] [-q, --quiet]
```

This command will refresh the checksum files for the specified artifact files in the maven repository. Sometimes the checksum files are not matched with the artifacts by some reason, so this command will do the refresh to make it match again. It will calculate the checksums of all artifact files in the specified path and compare with the companied checksum files of the artifacts, if the checksum are not matched, they will be refreshed.
5 changes: 5 additions & 0 deletions config/charon.yaml.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#aws_profile: ${profile}
#aws_cf_enable: True

ignore_patterns:
- ".*^(redhat).*"
- ".*snapshot.*"
Expand Down Expand Up @@ -30,3 +33,5 @@ targets:
- bucket: "stage-npm-npmjs"
prefix: /
registry: "npm.stage.registry.redhat.com"

#manifest_bucket: manifest
59 changes: 59 additions & 0 deletions image/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
####
# This Containerfile is used to build the container for charon
#
# charon requires python 3
#
# 0. Step into the project dir
#
# 1. Build the image
# docker/podman build -t charon:1.0.0 -f image/Containerfile .
#
# 2. Run the container as daemon, mount the host ~/upload/ path to container /root/upload/ path,
# the uploading path is the dir location where you will upload the tarballs from
# add -e to set specific environment variables, such as: AWS_PROFILE, aws_endpoint_url, bucket
# docker/podman run -dit -v ~/upload/:/home/charon/upload/ --name charon charon:1.0.0
#
# 3. Execute the container
# docker/podman exec -it charon bash
#
# 4. Start using uploader
# charon upload/delete from /home/charon/upload/...
###
FROM registry.access.redhat.com/ubi8-minimal:latest as builder

ARG GIT_BRANCH=main

RUN microdnf install -y git-core python3.12 python3.12-pip && microdnf clean all
RUN git clone -b ${GIT_BRANCH} --depth 1 https://github.com/Commonjava/charon.git
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 wheel ./charon

FROM registry.access.redhat.com/ubi8-minimal:latest

ARG USER=charon
ARG UID=10000
ARG HOME_DIR=/home/${USER}

WORKDIR ${HOME_DIR}

USER root

RUN microdnf install -y python3.12 python3.12-pip shadow-utils && microdnf clean all
RUN useradd -d ${HOME_DIR} -u ${UID} -g 0 -m -s /bin/bash ${USER} \
&& chown ${USER}:0 ${HOME_DIR} \
&& chmod -R g+rwx ${HOME_DIR} \
&& chmod g+rw /etc/passwd

COPY --from=builder ./*.whl ./
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir ./*.whl
RUN rm ./*.whl

RUN microdnf remove python3.12-pip shadow-utils && microdnf clean all

USER ${USER}

ENV HOME=${HOME_DIR} \
LANG=en_US.UTF-8

CMD ["/usr/local/bin/charon"]
23 changes: 12 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
setuptools-rust==1.7.0
Jinja2==3.1.4
boto3==1.28.46
botocore==1.31.46
click==8.1.7
requests==2.31.0
PyYAML==6.0.1
defusedxml==0.7.1
subresource-integrity==0.2
jsonschema==4.19.0
urllib3==1.26.18
Jinja2>=3.1.4
boto3>=1.28.46
botocore>=1.31.46
click>=8.1.7
requests>=2.31.0
PyYAML>=6.0.1
defusedxml>=0.7.1
subresource-integrity>=0.2
jsonschema>=4.19.0
urllib3>=1.26.18
semantic-version>=2.10.0
setuptools>=70.0.0
20 changes: 15 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
"""
from setuptools import setup, find_packages

version = "1.3.1"
version = "1.3.2"

# f = open('README.md')
# long_description = f.read().strip()
# long_description = long_description.split('split here', 1)[1]
# f.close()
long_description = """
This charon is a tool to synchronize several types of
artifacts repository data to RedHat Ronda service (maven.repository.redhat.com).
Expand Down Expand Up @@ -50,4 +46,18 @@
entry_points={
"console_scripts": ["charon = charon.cmd:cli"],
},
install_requires=[
"Jinja2>=3.1.4",
"boto3>=1.28.46",
"botocore>=1.31.46",
"click>=8.1.7",
"requests>=2.31.0",
"PyYAML>=6.0.1",
"defusedxml>=0.7.1",
"subresource-integrity>=0.2",
"jsonschema>=4.19.0",
"urllib3>=1.26.18",
"semantic-version>=2.10.0",
"setuptools>=70.0.0",
],
)
4 changes: 2 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pytest-cov
pytest-html
flake8
requests-mock
moto==5.0.3
python-gnupg==0.5.0
moto>=5.0.3,<6
python-gnupg>=0.5.0,<1