Jenkins pass paramater as an env to the shell script for passing sh to kubernetes pod
You can keep placeholders for such values which requires to be updated dynamically at build time.I'd keep the shell-script as below with placeholders instead of variables:
#!/bin/shmvn --projects <PROJECTNAME> --also-make clean test -Dcucumber.filter.tags="@<SERVICENAME> or @<TAG>" -Denvironment=test -Ddhc=true -Djavax.net.ssl.trustStore=/usr/java/openjdk-14/lib/security/cacerts
And then add a sed
line within the sh block
above your helm upgrade ...
command to replace the placeholders with build time values so that it can passed to the next set of actions.
sh """sed -i \"s/<PROJECTNAME>/${projectName}/g; s/<SERVICENAME>/${service_name}/g; s/<TAG>/${tag}/g\" /path/to/test-script.shhelm upgrade . . . """
EDIT-1:
Example: if (serviceName == 'xx') { env.TAG = serviceName} sh """.... other actions"""