Skip to content

Commit

Permalink
Merge pull request #330 from Vandebron/feature/TECH-435-DRYRUN-FLAG
Browse files Browse the repository at this point in the history
[TECH-435] add dryrun flag
  • Loading branch information
ewaldschrader authored Dec 15, 2023
2 parents 9c67ede + 321bc23 commit d07455d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/mpyl/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ def run_mpyl(
properties=run_properties,
steps_collection=StepsCollection(logger=logger),
)
run_result = run_build(run_result, steps, reporter, cli_parameters.local)

run_result = run_build(
run_result,
steps,
reporter,
cli_parameters.dryrun or cli_parameters.local,
)
except ValidationError as exc:
console.log(
f'Schema validation failed {exc.message} at `{".".join(map(str, exc.path))}`'
Expand Down
1 change: 1 addition & 0 deletions src/mpyl/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MpylCliParameters:
all: bool = False
stage: Optional[str] = None
projects: Optional[str] = None
dryrun: bool = True


async def get_publication_info(test: bool = False) -> dict:
Expand Down
17 changes: 16 additions & 1 deletion src/mpyl/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,23 @@ def invoke(self, ctx):
required=False,
help="Comma separated list of the projects to build",
)
@click.option(
"--dryrun",
"dryrun_",
is_flag=True,
default=False,
help="don't push or deploy images",
)
@click.pass_obj
def run(
obj: CliContext, ci, all_, tag, stage, sequential, projects
obj: CliContext,
ci,
all_,
tag,
stage,
sequential,
projects,
dryrun_,
): # pylint: disable=invalid-name
run_result_file = Path(BUILD_ARTIFACTS_FOLDER) / "run_result"
if not sequential and run_result_file.is_file():
Expand All @@ -178,6 +192,7 @@ def run(
tag=tag,
stage=stage,
projects=projects,
dryrun=dryrun_,
)
obj.console.log(parameters)

Expand Down

0 comments on commit d07455d

Please sign in to comment.