Variable concatenation with Suffix and Prefix

This article discusses the difference examples and recommended way to use thew concatenation of variables.

Use the below expression for concatenation in pipeline/stage having a suffix :

<+pipeline.variables.var1.concat("_suffix")>

Example :

<+pipeline.variables.vartest.concat("/test.war")>

Use the below expression for concatenation in pipeline/stage having a prefix :

<+"releases/dctrn/" + <+stage.name>>

Example :

<+"releases/dctrn/" + <+stage.name.concat("/values.yaml")>>

Printed Value:

Usage of the above example for Suffix and Prefix using the stage variables :

Printing the variables using the stage variables with suffix and prefix in a shell script :

Out of the above variables resolving :

Note :

<+pipeline.variable.var1>_suffix works if you use directly in the shell script but we don’t recommend as its not uniform across Harness Hence we recommend to use concat or + as mentioned in doc.

1 Like