Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean-deploy and reset-deploy commands #304

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
30 changes: 28 additions & 2 deletions docs/docs/user/references/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $ kpops [OPTIONS] COMMAND [ARGS]...
* `deploy`: Deploy pipeline steps
* `destroy`: Destroy pipeline steps
* `generate`: Enriches pipelines steps with defaults.
* `reprocess`: Cleans and deploys pipeline steps
* `reset`: Reset pipeline steps
* `schema`: Generate json schema.

Expand Down Expand Up @@ -67,9 +68,9 @@ $ kpops deploy [OPTIONS] PIPELINE_PATH [COMPONENTS_MODULE]
* `--pipeline-base-dir DIRECTORY`: Base directory to the pipelines (default is current working directory) [env var: KPOPS_PIPELINE_BASE_DIR; default: .]
* `--defaults DIRECTORY`: Path to defaults folder [env var: KPOPS_DEFAULT_PATH]
* `--config FILE`: Path to the config.yaml file [env var: KPOPS_CONFIG_PATH; default: config.yaml]
* `--verbose / --no-verbose`: [default: no-verbose]
* `--dry-run / --execute`: Whether to dry run the command or execute it [default: dry-run]
* `--steps TEXT`: Comma separated list of steps to apply the command on [env var: KPOPS_PIPELINE_STEPS]
* `--dry-run / --execute`: Whether to dry run the command or execute it [default: dry-run]
* `--verbose / --no-verbose`: [default: no-verbose]
* `--help`: Show this message and exit.

## `kpops destroy`
Expand Down Expand Up @@ -125,6 +126,31 @@ $ kpops generate [OPTIONS] PIPELINE_PATH [COMPONENTS_MODULE]
* `--cert-file TEXT`: Identify HTTPS client using this SSL certificate file
* `--help`: Show this message and exit.

## `kpops reprocess`

Cleans and deploys pipeline steps

**Usage**:

```console
$ kpops reprocess [OPTIONS] PIPELINE_PATH [COMPONENTS_MODULE]
```

**Arguments**:

* `PIPELINE_PATH`: Path to YAML with pipeline definition [env var: KPOPS_PIPELINE_PATH;required]
* `[COMPONENTS_MODULE]`: Custom Python module containing your project-specific components

**Options**:

* `--pipeline-base-dir DIRECTORY`: Base directory to the pipelines (default is current working directory) [env var: KPOPS_PIPELINE_BASE_DIR; default: .]
* `--defaults DIRECTORY`: Path to defaults folder [env var: KPOPS_DEFAULT_PATH]
* `--config FILE`: Path to the config.yaml file [env var: KPOPS_CONFIG_PATH; default: config.yaml]
* `--steps TEXT`: Comma separated list of steps to apply the command on [env var: KPOPS_PIPELINE_STEPS]
* `--dry-run / --execute`: Whether to dry run the command or execute it [default: dry-run]
* `--verbose / --no-verbose`: [default: no-verbose]
* `--help`: Show this message and exit.

## `kpops reset`

Reset pipeline steps
Expand Down
38 changes: 36 additions & 2 deletions kpops/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ def deploy(
components_module: Optional[str] = COMPONENTS_MODULES,
defaults: Optional[Path] = DEFAULT_PATH_OPTION,
config: Path = CONFIG_PATH_OPTION,
verbose: bool = False,
dry_run: bool = DRY_RUN,
steps: Optional[str] = PIPELINE_STEPS,
dry_run: bool = DRY_RUN,
verbose: bool = False,
):
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
Expand Down Expand Up @@ -346,6 +346,40 @@ def clean(
component.clean(dry_run)


@app.command(help="Cleans and deploys pipeline steps")
def reprocess(
pipeline_base_dir: Path = BASE_DIR_PATH_OPTION,
pipeline_path: Path = PIPELINE_PATH_ARG,
components_module: Optional[str] = COMPONENTS_MODULES,
defaults: Optional[Path] = DEFAULT_PATH_OPTION,
config: Path = CONFIG_PATH_OPTION,
steps: Optional[str] = PIPELINE_STEPS,
dry_run: bool = DRY_RUN,
verbose: bool = False,
):
clean(
pipeline_base_dir,
pipeline_path,
components_module,
defaults,
config,
steps,
dry_run,
verbose,
)

deploy(
pipeline_base_dir,
pipeline_path,
components_module,
defaults,
config,
steps,
dry_run,
verbose,
)
Comment on lines +394 to +414
Copy link
Member

Choose a reason for hiding this comment

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

equivalent of running kpops clean && kpops deploy?



def version_callback(show_version: bool) -> None:
if show_version:
typer.echo(f"KPOps {__version__}")
Expand Down