Skip to content

Commit

Permalink
chore: add product flag and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielBusta committed Nov 16, 2023
1 parent 4390121 commit 0e6062f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# mozilla-gcp-ar-pkg-manager

`mozilla-releng/mozilla-gcp-ar-pkg-manager` is a Python tool for managing Mozilla product packages hosted in software repositories. It can be used to clean-up obsolete Firefox Nightly versions.
`mozilla-releng/mozilla-gcp-ar-pkg-manager` is a Python tool for managing Mozilla product packages hosted in GCP software repositories. It can be used to clean-up obsolete Firefox Nightly versions.

## Requirements
- Python 3.11 or higher
Expand All @@ -20,18 +20,19 @@
### Running `mozilla-gcp-ar-pkg-manager`
To run `mozilla-gcp-ar-pkg-manager`, use Poetry with the following command:
```bash
poetry run mozilla-gcp-ar-pkg-manager clean-up --channel [CHANNEL] --retention-days [DAYS]
poetry run mozilla-gcp-ar-pkg-manager clean-up --product [PRODUCT] --channel [CHANNEL] --retention-days [DAYS]
```

### Parameters
- `--channel`: Specifies the package channel (e.g., `nightly`, `release`, `beta`). Currently, only `nightly` is supported.
- `--product`: Specifies the Mozilla product to manage (e.g. `nightly`, `release`, `beta`). Currently, only `firefox` is supported.
- `--channel`: Specifies the package channel (e.g. `nightly`, `release`, `beta`). Currently, only `nightly` is supported.
- `--retention-days`: Sets the retention period in days for packages in the nightly channel. This parameter is only supported on the `nightly` channel.

### Example
To clean up nightly packages that are older than 7 days:

```bash
poetry run mozilla-gcp-ar-pkg-manager clean-up --channel nightly --retention-days 7
poetry run mozilla-gcp-ar-pkg-manager clean-up --product firefox --channel nightly --retention-days 7
```

## Building and Installing a Python Wheel
Expand All @@ -50,5 +51,5 @@ The `mozilla-gcp-ar-pkg-manager` package can be packaged into a wheel file for d
After installation, the package can be used from anywhere on your system, provided you are running the Python interpreter where it was installed. For example:

```bash
mozilla-gcp-ar-pkg-manager clean-up --channel nightly --retention-days 5
mozilla-gcp-ar-pkg-manager clean-up --product firefox --channel nightly --retention-days 3
```
10 changes: 9 additions & 1 deletion src/mozilla_gcp_ar_pkg_manager/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ def main():
clean_up_parser = subparsers.add_parser(
"clean-up", help="Clean up package versions."
)
clean_up_parser.add_argument(
"--product",
type=str,
help="Product in the packages (i.e. firefox)",
required=True,
)
clean_up_parser.add_argument(
"--channel",
type=str,
help="Channel of the packages (e.g., nightly, release, beta)",
help="Channel of the packages (e.g. nightly, release, beta)",
required=True,
)
clean_up_parser.add_argument(
Expand All @@ -110,6 +116,8 @@ def main():
args = parser.parse_args()

if args.command == "clean-up":
if args.product != "firefox":
raise ValueError("firefox is the only supported product")
if args.channel == "nightly":
if args.retention_days is None:
raise ValueError(
Expand Down

0 comments on commit 0e6062f

Please sign in to comment.