Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding JQ command to PHP CLI image #360

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

IgorVitol
Copy link

Description

Magento/Adobe Commerce Cloud ENVs are using "base64 + json encoded" ENV variables for storing credentials & configuration. Like:

  • MAGENTO_CLOUD_RELATIONSHIPS

You would need to read this ENV variable in case when it is required to build a cross-env "bash" script which would be tested/used locally as well (like DB operations, etc).

The easiest way to properly read json data in "bash" without injecting PHP would be using "jq", like:
MYSQL_USER="$(echo $MAGENTO_CLOUD_RELATIONSHIPS | base64 -d | jq -r '.database[0].username')"

All the Magento Cloud ENVs (Integration/Staging/PROD) has "jq" installed by default, but it doesn't exists locally, forcing us to install it locally (via apt-get) each time when the script should be executed.

Manual testing scenarios

  1. Execute next command from within PHP CLI container (eg "deploy" one)
    echo $MAGENTO_CLOUD_RELATIONSHIPS | base64 -d | jq -r '.database[0].username'

image

Release notes

Added "jq" CLI tool to easily read json-encoded ENV variables in PHP CLI containers.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • Pull request introduces user-facing changes and includes meaningful release notes and documentation
  • All commits are accompanied by meaningful commit messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant