From c8247dbda0aada1f4fd355465853379df2a91939 Mon Sep 17 00:00:00 2001 From: Martijn Swinkels Date: Tue, 2 Apr 2024 15:44:00 +0200 Subject: [PATCH] Allow usage of static encryption key --- magento-integration-tests/7.0/action.yml | 3 +++ magento-integration-tests/7.1/action.yml | 3 +++ magento-integration-tests/7.2/action.yml | 3 +++ magento-integration-tests/7.3/action.yml | 3 +++ magento-integration-tests/7.4/action.yml | 3 +++ magento-integration-tests/8.1/action.yml | 3 +++ magento-integration-tests/8.2/action.yml | 3 +++ magento-integration-tests/8.3/action.yml | 3 +++ magento-integration-tests/entrypoint.sh | 20 +++++++++++++++----- 9 files changed, 39 insertions(+), 5 deletions(-) diff --git a/magento-integration-tests/7.0/action.yml b/magento-integration-tests/7.0/action.yml index 859b448..bfdde2e 100644 --- a/magento-integration-tests/7.0/action.yml +++ b/magento-integration-tests/7.0/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false runs: using: 'docker' image: 'docker://extdn/magento-integration-tests-action:7.0-latest' diff --git a/magento-integration-tests/7.1/action.yml b/magento-integration-tests/7.1/action.yml index b3fc1f7..48da43e 100644 --- a/magento-integration-tests/7.1/action.yml +++ b/magento-integration-tests/7.1/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false runs: using: 'docker' image: 'docker://extdn/magento-integration-tests-action:7.1-latest' diff --git a/magento-integration-tests/7.2/action.yml b/magento-integration-tests/7.2/action.yml index 87861ed..7829a87 100644 --- a/magento-integration-tests/7.2/action.yml +++ b/magento-integration-tests/7.2/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false runs: using: 'docker' image: 'docker://extdn/magento-integration-tests-action:7.2-latest' diff --git a/magento-integration-tests/7.3/action.yml b/magento-integration-tests/7.3/action.yml index 8740e38..b064297 100644 --- a/magento-integration-tests/7.3/action.yml +++ b/magento-integration-tests/7.3/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false runs: using: 'docker' image: 'docker://extdn/magento-integration-tests-action:7.3-latest' diff --git a/magento-integration-tests/7.4/action.yml b/magento-integration-tests/7.4/action.yml index 823030c..ae64c87 100644 --- a/magento-integration-tests/7.4/action.yml +++ b/magento-integration-tests/7.4/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false composer_version: description: 'The composer version to use. Can be either 1 or 2.' required: false diff --git a/magento-integration-tests/8.1/action.yml b/magento-integration-tests/8.1/action.yml index 17222ea..276526a 100644 --- a/magento-integration-tests/8.1/action.yml +++ b/magento-integration-tests/8.1/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false composer_version: description: 'The composer version to use. Can be either 1 or 2.' required: false diff --git a/magento-integration-tests/8.2/action.yml b/magento-integration-tests/8.2/action.yml index 745e2a5..10c8c28 100644 --- a/magento-integration-tests/8.2/action.yml +++ b/magento-integration-tests/8.2/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false composer_version: description: 'The composer version to use. Can be either 1 or 2.' required: false diff --git a/magento-integration-tests/8.3/action.yml b/magento-integration-tests/8.3/action.yml index a314887..2c49039 100644 --- a/magento-integration-tests/8.3/action.yml +++ b/magento-integration-tests/8.3/action.yml @@ -36,6 +36,9 @@ inputs: magento_post_install_script: description: 'Relative path to an optional script after Magento installation is run. Leave empty to use the default.' required: false + magento_encryption_key: + description: 'Static encryption key to be used during Magento installation.' + required: false composer_version: description: 'The composer version to use. Can be either 1 or 2.' required: false diff --git a/magento-integration-tests/entrypoint.sh b/magento-integration-tests/entrypoint.sh index e7153a7..b67d97f 100755 --- a/magento-integration-tests/entrypoint.sh +++ b/magento-integration-tests/entrypoint.sh @@ -36,7 +36,7 @@ echo "Using composer ${COMPOSER_VERSION}" ln -s /usr/local/bin/composer$COMPOSER_VERSION /usr/local/bin/composer echo "Pre Project Script [pre_project_script]: $INPUT_PRE_PROJECT_SCRIPT" -if [[ ! -z "$INPUT_PRE_PROJECT_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_PRE_PROJECT_SCRIPT" ]] ; then +if [[ -n "$INPUT_PRE_PROJECT_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_PRE_PROJECT_SCRIPT" ]] ; then echo "Running custom pre_project_script: ${INPUT_PRE_PROJECT_SCRIPT}" . ${GITHUB_WORKSPACE}/$INPUT_PRE_PROJECT_SCRIPT fi @@ -60,7 +60,7 @@ cp -R ${GITHUB_WORKSPACE}/${MODULE_SOURCE} $GITHUB_ACTION cd $MAGENTO_ROOT echo "Post Project Script [post_project_script]: $INPUT_POST_PROJECT_SCRIPT" -if [[ ! -z "$INPUT_POST_PROJECT_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_POST_PROJECT_SCRIPT" ]] ; then +if [[ -n "$INPUT_POST_PROJECT_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_POST_PROJECT_SCRIPT" ]] ; then echo "Running custom post_project_script: ${INPUT_POST_PROJECT_SCRIPT}" . ${GITHUB_WORKSPACE}/$INPUT_POST_PROJECT_SCRIPT fi @@ -72,7 +72,7 @@ composer config repositories.magento composer $REPOSITORY_URL composer require $COMPOSER_NAME:@dev --no-update --no-interaction echo "Pre Install Script [magento_pre_install_script]: $INPUT_MAGENTO_PRE_INSTALL_SCRIPT" -if [[ ! -z "$INPUT_MAGENTO_PRE_INSTALL_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_MAGENTO_PRE_INSTALL_SCRIPT" ]] ; then +if [[ -n "$INPUT_MAGENTO_PRE_INSTALL_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_MAGENTO_PRE_INSTALL_SCRIPT" ]] ; then echo "Running custom magento_pre_install_script: ${INPUT_MAGENTO_PRE_INSTALL_SCRIPT}" . ${GITHUB_WORKSPACE}/$INPUT_MAGENTO_PRE_INSTALL_SCRIPT fi @@ -112,6 +112,11 @@ if bin/magento setup:install --help | grep -q '\-\-search\-engine='; then SETUP_ARGS="$SETUP_ARGS --search-engine=elasticsearch7" fi +if [[ -n "$INPUT_MAGENTO_ENCRYPTION_KEY" ]]; then + echo "Adding static encryption key" + SETUP_ARGS="$SETUP_ARGS --key=$INPUT_MAGENTO_ENCRYPTION_KEY" +fi + if [[ "$ELASTICSEARCH" == "1" ]]; then SETUP_ARGS="$SETUP_ARGS --elasticsearch-host=es --elasticsearch-port=9200 --elasticsearch-enable-auth=0 --elasticsearch-timeout=60" fi @@ -120,13 +125,13 @@ echo "Run Magento setup: $SETUP_ARGS" php bin/magento setup:install $SETUP_ARGS echo "Post Install Script [magento_post_install_script]: $INPUT_MAGENTO_POST_INSTALL_SCRIPT" -if [[ ! -z "$INPUT_MAGENTO_POST_INSTALL_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_MAGENTO_POST_INSTALL_SCRIPT" ]] ; then +if [[ -n "$INPUT_MAGENTO_POST_INSTALL_SCRIPT" && -f "${GITHUB_WORKSPACE}/$INPUT_MAGENTO_POST_INSTALL_SCRIPT" ]] ; then echo "Running custom magento_post_install_script: ${INPUT_MAGENTO_POST_INSTALL_SCRIPT}" . ${GITHUB_WORKSPACE}/$INPUT_MAGENTO_POST_INSTALL_SCRIPT fi echo "Trying phpunit.xml file $PHPUNIT_FILE" -if [[ ! -z "$PHPUNIT_FILE" ]] ; then +if [[ -n "$PHPUNIT_FILE" ]] ; then PHPUNIT_FILE=${GITHUB_WORKSPACE}/${PHPUNIT_FILE} fi @@ -142,6 +147,11 @@ if [[ "$ELASTICSEARCH" == "1" ]]; then cp /docker-files/install-config-mysql-with-es.php dev/tests/integration/etc/install-config-mysql.php fi +if [[ -n "$INPUT_MAGENTO_ENCRYPTION_KEY" ]]; then + key_install_config="\ 'key' => '$INPUT_MAGENTO_ENCRYPTION_KEY',"; + sed -i "/]/i $key_install_config" dev/tests/integration/etc/install-config-mysql.php +fi + sed "s#%COMPOSER_NAME%#$COMPOSER_NAME#g" $PHPUNIT_FILE > dev/tests/integration/phpunit.xml for TESTSFOLDER in $(xmlstarlet select -t -v '/phpunit/testsuites/testsuite/directory/text()' dev/tests/integration/phpunit.xml)