repository-service-tuf / repository-service-tuf-cli

Repository Service for TUF: Command Line Interface
https://pypi.org/project/repository-service-tuf/
MIT License
8 stars 15 forks source link

Introduce `--offline` and `--api-server` for admin & `ceremony` add support for API #602

Closed MVrachev closed 4 weeks ago

MVrachev commented 1 month ago

Description

As discussed with @kairoaraujo I have also introduced the --offline and --api-server admin level options in this pr as well.

In this pr I added "--offline" and "--api-server" as admin-level command options which will be reused by all admin subcommands. This allows for a single place of exception handling for those two arguments and consistent behavior across commands. This allowed the removal of "--bootstrap" in ceremony and "--api-server" options for both "ceremony" and "sign".

The "--offline" option allows you to have a local setting.SERVER configuration but still run the commands in a disconnected manner for testing.

Additionally, with "--api-server" and the "--save" (option for "send") or "output" (argument for ceremony) you can upload the payload to the RSTUF API and save the result of the command locally.

Tests for all tests are added and documentation is updated.

Additionally, in this pr I implement some of the missing features from our new admin ceremony.

The features included here are:

Signed-off-by: Martin Vrachev martin.vrachev@broadcom.com

Related to #533.

Types of changes

Additional requirements

Code of Conduct

By submitting this PR, you agree to follow our Code of Conduct.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.84%. Comparing base (47d0a69) to head (8472b56). Report is 88 commits behind head on main.

:exclamation: Current head 8472b56 differs from pull request most recent head 3f1a803

Please upload reports for the commit 3f1a803 to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #602 +/- ## ========================================== - Coverage 98.90% 98.84% -0.07% ========================================== Files 20 26 +6 Lines 1367 1900 +533 ========================================== + Hits 1352 1878 +526 - Misses 15 22 +7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MVrachev commented 1 month ago

As discussed with @kairoaraujo I have also introduced the --offline and --api-server admin level options in this pr as well in my last two commits.

lukpueh commented 1 month ago

Can we try to keep diffs to a minimum? I understand that it sometimes just isn't feasible, but this PR definitely mixes some unrelated things.

lukpueh commented 1 month ago

Also, a consistent/accurate PR description would be helpful, e.g.:

Automatically save if --bootstrap is used even if --output file argument is not provided. The saved location is a default one - ceremony_payload.json.

vs.

This allowed the removal of "--bootstrap" in ceremony and "--api-server" options for both "ceremony" and "sign".

lukpueh commented 1 month ago

This is going in the right direction. Here are a few comments on args/opts:

I think we should...

rstuf [--api-server] admin ceremony [--out [PATH]] [--dry-run]

Perform ceremony and send result to API to trigger bootstrap.

* If `--out [PATH]` is passed, result is written to local PATH (in addition to
  being sent to API).

* If `--dry-run` is passed, result is not sent to API. You can pass `--out
  [PATH]` to store the result locally. `--api-server` will be ignored and may
  be omitted.
rstuf [--api-server] admin metadata {sign, update} [--in PATH] [--out [PATH]] [--dry-run]

Perform sign/metadata update for pending event and send result to API.

* If `--in PATH` is passed, input is not read from API but from local PATH.

* If `--out [PATH]` is passed, result is written to local PATH (in addition to
  being sent to API).

* If `--dry-run` is passed, result is not sent to API. You can pass `--out
  [PATH]` to store the result locally. 

* If `--in` and `--dry-run` is passed, `--api-server` will be ignored and 
  may be omitted.

(I'm open to naming suggestions)

MVrachev commented 1 month ago

607 will replace the first 4 commits of this pr and Ceremony: mandate threshold > 2 & add tests commit.

Please, review it before this one as this pr will be on top of it.

MVrachev commented 4 weeks ago

This pr is superseded by: https://github.com/repository-service-tuf/repository-service-tuf-cli/pull/607 and https://github.com/repository-service-tuf/repository-service-tuf-cli/pull/612.