Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use the pipeline "Deployments Parameters"?

Tor Noppon SETTASATIEN
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 30, 2019

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.

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events