Skip to content

Commit 22f1330

Browse files
committed
CLOUDP-295785 - add pipeline_main.py extended help
1 parent bec8626 commit 22f1330

File tree

1 file changed

+52
-11
lines changed

1 file changed

+52
-11
lines changed

scripts/release/pipeline_main.py

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def build_image(image_name: str, build_configuration: ImageBuildConfiguration):
9595
def image_build_config_from_args(args) -> ImageBuildConfiguration:
9696
image = args.image
9797

98-
build_scenario = get_scenario_from_arg(args.scenario) or BuildScenario.infer_scenario_from_environment()
98+
build_scenario = get_scenario_from_arg(args.build_scenario) or BuildScenario.infer_scenario_from_environment()
9999

100100
build_info = load_build_info(build_scenario)
101101
logger.info(f"image is {image}")
@@ -177,34 +177,75 @@ def _setup_tracing():
177177

178178
def main():
179179
_setup_tracing()
180-
parser = argparse.ArgumentParser(description="Build container images.")
181-
parser.add_argument("image", help="Image to build.") # Required
182-
parser.add_argument("--parallel", action="store_true", help="Build images in parallel.")
183-
parser.add_argument("--sign", action="store_true", help="Sign images.")
180+
supported_images = list(get_builder_function_for_image_name().keys())
181+
supported_scenarios = list(BuildScenario)
182+
183+
parser = argparse.ArgumentParser(
184+
description="""Builder tool for container images. It allows to push and sign images with multiple architectures using Docker Buildx.
185+
By default build information is read from 'build_info.json' file in the project root directory based on the build scenario.
186+
It can be inferred from the environment variables or overridden with the '--build-scenario' option.""",
187+
)
188+
parser.add_argument(
189+
"image",
190+
metavar="image",
191+
action="store",
192+
type=str,
193+
choices=supported_images,
194+
help=f"Image name to build. Supported images: {", ".join(supported_images)}",
195+
)
184196
parser.add_argument(
185-
"--scenario",
186-
choices=list(BuildScenario),
187-
help=f"Override the build scenario instead of inferring from environment. Options: release, patch, master, development",
197+
"-b",
198+
"--build-scenario",
199+
metavar="",
200+
action="store",
201+
type=str,
202+
choices=supported_scenarios,
203+
help=f"""Override the build scenario instead of inferring from environment. Options: {", ".join(supported_scenarios)}.
204+
Default is to infer from environment variables. For '{BuildScenario.DEVELOPMENT}' the '{BuildScenario.PATCH}' scenario is used to read values from 'build_info.json'""",
188205
)
189-
# Override arguments for build context and configuration
190206
parser.add_argument(
207+
"-p",
191208
"--platform",
209+
metavar="",
210+
action="store",
211+
type=str,
192212
help="Override the platforms instead of resolving from build scenario. Multi-arch builds are comma-separated. Example: linux/amd64,linux/arm64",
193213
)
194214
parser.add_argument(
215+
"-v",
195216
"--version",
196-
help="Override the version/tag instead of resolving from build scenario",
217+
metavar="",
218+
action="store",
219+
type=str,
220+
help="Override the version/tag instead of resolving from build scenario. Default is to infer from environment variables based on the selected scenario.",
197221
)
198222
parser.add_argument(
223+
"-r",
199224
"--registry",
225+
metavar="",
226+
action="store",
227+
type=str,
200228
help="Override the base registry instead of resolving from build scenario",
201229
)
230+
parser.add_argument(
231+
"-s",
232+
"--sign",
233+
action="store_true",
234+
help="If set force image signing. Default is to infer from build scenario.",
235+
)
202236
# For agent builds
237+
parser.add_argument(
238+
"--parallel",
239+
action="store_true",
240+
help="Build agent images in parallel.",
241+
)
203242
parser.add_argument(
204243
"--parallel-factor",
244+
metavar="",
205245
default=0,
246+
action="store",
206247
type=int,
207-
help="Number of builds to run in parallel, defaults to number of cores",
248+
help="Number of agent builds to run in parallel, defaults to number of cores",
208249
)
209250

210251
args = parser.parse_args()

0 commit comments

Comments
 (0)