Pipelines seems to remove text from output

rob_norman-clarity January 19, 2023

I have the following lines in my bitbucket-pipelines.yml inside a step:

 

- printf "$conf['reverse_proxy'] = true;\n" >> settings.php
- printf "$conf['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);\n" >> settings.php

which should append the two lines of text into the settings.php file.  Neither of the two $conf or $_SERVER are variables defined in my repository or deployment, but when I check the content of the file they are being removed and all i'm left with is:

['reverse_proxy'] = true;
['reverse_proxy_addresses'] = array(['REMOTE_ADDR']);

at the bottom of the file. I have tried everything I can think of to escape the $ and i've tried echo instead of printf in case it was some weird edge case.  I've also tried running the commands directly in a bash terminal and they output exactly what i'd expect.

In case it's relevant, i'm using the atlassian/default-image:3 image for the pipeline

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2023

Hi @rob_norman-clarity,

Welcome to the community.

I do believe this is possible using echo command, you'll just need to produce those literal $ signs outside the double quotes.

You can use the below commands instead:

- echo '$conf'"['reverse_proxy'] = true;\n" >> settings.php
- echo '$conf'"['reverse_proxy_addresses'] = array("'$_SERVER'"['REMOTE_ADDR']);\n" >> settings.php

Hope it helps and let me know how it goes.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events