Skip to content

Commit

Permalink
Reformat s2i command string for clarity
Browse files Browse the repository at this point in the history
Use python3 f-strings so we can use the variable name directly at
the substitution site and not have to keep count of the number of
'%s' we've put in.

Signed-off-by: Jonathan Dowland <[email protected]>
  • Loading branch information
jmtd committed Nov 21, 2024
1 parent bad1c72 commit 8c6787a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions steps/s2i_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ def s2i_inner(context, application, path='.', env="", incremental=False, tag="ma
mirror = "-e 'MAVEN_MIRROR_URL=%s'" % os.getenv("MAVEN_MIRROR_URL")

image_id = "integ-" + context.image
command = "s2i build --loglevel=5 --pull-policy if-not-present %s --context-dir=%s -r=%s %s %s %s %s %s %s" % (
mirror, path, tag, env, application, context.image, image_id, "--incremental" if incremental else "",
"--runtime-image="+runtime_image if runtime_image else ""
)

command = f"""s2i build --loglevel=5 --pull-policy if-not-present\
{mirror}\
--context-dir={path}\
-r={tag}\
{env}\
{application}\
{context.image}\
{image_id}\
{"--incremental" if incremental else ""}\
{"--runtime-image="+runtime_image if runtime_image else ""}\
"""

logger.info("Executing new S2I build with the command [%s]..." % command)

output = _execute(command)
Expand Down

0 comments on commit 8c6787a

Please sign in to comment.