Skip to content
Snippets Groups Projects
Commit edcf6cfe authored by jurgenhaas's avatar jurgenhaas
Browse files

mobimo/assets#42 Implement CI job to deploy assets to Drupal

parent 63c24e64
No related branches found
No related tags found
No related merge requests found
......@@ -116,8 +116,8 @@ CopyDataToStage:
- IFS=' ' read sourcebranch targetbranch <<< ${CHAT_INPUT}
- echo "Source ${sourcebranch}"
- echo "Target ${targetbranch}"
- if [[ ! -d /data/${sourcebranch}/app ]]; then "Source branch does not exist!"; exit 1; fi
- if [[ ! -d /data/${targetbranch}/app ]]; then "Target branch does not exist!"; exit 2; fi
- if [[ ! -d /data/${sourcebranch}/app ]]; then echo "Source branch does not exist!"; exit 1; fi
- if [[ ! -d /data/${targetbranch}/app ]]; then echo "Target branch does not exist!"; exit 2; fi
- if [[ "${targetbranch}" == "main" ]]; then echo "Main branch is not an allowed target!"; exit 3; fi
- docker compose --project-name ${PROJECT_NAME}_${sourcebranch} exec php drush sql:dump --result-file=/var/backups/mysql/drupal.sql
- rsync -rlDzogtp /data/${sourcebranch}/files/ /data/${targetbranch}/files/
......@@ -137,7 +137,7 @@ ResetLocales:
script:
- IFS=' ' read branch <<< ${CHAT_INPUT}
- echo "Branch ${branch}"
- if [[ ! -d /data/${branch}/app ]]; then "Branch does not exist!"; exit 1; fi
- if [[ ! -d /data/${branch}/app ]]; then echo "Branch does not exist!"; exit 1; fi
- cd /data/${branch}/app
- docker compose --project-name ${PROJECT_NAME}_${branch} exec php drush -y sql:query "truncate locales_location;"
- docker compose --project-name ${PROJECT_NAME}_${branch} exec php drush -y sql:query "truncate locales_source;"
......@@ -150,18 +150,26 @@ ResetLocales:
# @todo Lets also itegrate through drupal_extra_locales, hmm, that's an Ansible variable
DeployAssetsToDrupal:
variables:
GIT_STRATEGY: none
tags:
- deploylocal
before_script: !reference [.prepareaccess, before_script]
cache: {}
only:
refs:
- triggers
- chat
variables:
- $CI_PIPELINE_SOURCE == 'chat' || $TRIGGERTASK == 'DeployAssetsToDrupal'
script:
- echo "We need to pull the asset repository and do our work on the Drupal site"
# variables:
# - $CI_PIPELINE_SOURCE == 'chat' || $TRIGGERTASK == 'DeployAssetsToDrupal'
- if [[ ! -d /data/${CI_COMMIT_REF_NAME}/app ]]; then echo "Branch does not exist!"; exit 1; fi
- ASSET_REPO=$(yq eval .inventory.assets.url .lakedrops.yml)
- if [[ "$ASSET_REPO" == "null" ]]; then exit 1; fi
- ASSET_PATH=$(yq eval .inventory.assets.namespace .lakedrops.yml)
- if [[ "$ASSET_PATH" == "null" ]]; then exit 2; fi
- ASSET_BRANCH=$(yq eval .inventory.assets.branch .lakedrops.yml)
- if [[ "$ASSET_BRANCH" == "null" ]]; then ASSET_BRANCH=main; fi
- cd /data/${CI_COMMIT_REF_NAME}/app
- rm -rf vendor/${ASSET_PATH}
- git clone -b ${ASSET_BRANCH} ${ASSET_REPO} vendor/${ASSET_PATH}
- drush migrate:import --all
- drush migrate:import --all
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment