I am having the issue with pipeline deployments parameters.
I use them for AWS deployment and also replace some stings (configurations) for each environment.
for AWS parameters, they are working fine, but for the parameters, they are not replaced.
Please see info below:
-- SETTING --
PIPELINES > Deployments > Environment:"Test" > Valiables:
name: "application_server", value: "x.aws.x.org"
-- CODE --
file: ./META-INF/context.xml
<setting>
<server:"${application_server}"/>
</setting>
file: bitbucket-pipelines.yml > script:
script:
- echo 'MVN Clean Install'
- mvn -B verify
- mvn -B clean
- mvn -B install
- mv ./target/*.war ./target/xapp.war
- unzip ./target/xapp.war -d ./target/xapp/
- cd ./target/xapp/
- sed -i 's/${application_server}/$application_server/g' ./META-INF/context.xml
- cat ./META-INF/context.xml
-- RESULT --
<setting>
<server:"$application_server"/>
</setting>
As you can see the RESULT in tag <server> this supposed to be "x.aws.x.org", but it was replaced as "$application_server"
Kindly let me know if you can help with this problem.
Hello @Tor Noppon SETTASATIEN,
I believe this is a matter of shell quoting, not specific to Pipelines. Single-quoted strings are not substituted. Basically, your command should rather be something like this:
sed -i 's/${application_server}/'"$application_server"'/g' ./META-INF/context.xml
Note that you can't simply replace single quote with a double quote because you need the first part to be matched as is.
Let me know if this works.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.