Commit 0885342f by Max Rothman Committed by GitHub

Merge pull request #3436 from edx/max/update-pipeline-migrations

Max/update pipeline migrations
parents 5f0f88bd 3d01d076
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
# - HIPCHAT_URL - URL of the hipchat API (defaults to v1 of the api) # - HIPCHAT_URL - URL of the hipchat API (defaults to v1 of the api)
# #
# Other variables: # Other variables:
# - unapplied_migrations_output - the filename where the unapplied migration YAML output is stored # - migration_plan - the filename where the unapplied migration YAML output is stored
# - migration_output - the filename where the migration output is saved # - migration_result - the filename where the migration output is saved
# - SUB_APPLICATION_NAME - used for migrations in edxapp {lms|cms}, must be specified # - SUB_APPLICATION_NAME - used for migrations in edxapp {lms|cms}, must be specified
# when APPLICATION_NAME is edxapp # when APPLICATION_NAME is edxapp
# - EDX_PLATFORM_SETTINGS - The settings to use for the edx platform {aws|devstack} DEFAULT: aws # - EDX_PLATFORM_SETTINGS - The settings to use for the edx platform {aws|devstack} DEFAULT: aws
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
- hosts: all - hosts: all
vars: vars:
unapplied_migrations_output: unapplied_migrations.yml migration_plan: migration_plan.yml
migration_output: migration_output.yml migration_result: migration_result.yml
HIPCHAT_URL: https://api.hipchat.com/v2/ HIPCHAT_URL: https://api.hipchat.com/v2/
EDX_PLATFORM_SETTINGS: "aws" EDX_PLATFORM_SETTINGS: "aws"
COMMAND_PREFIX: " . {{ APPLICATION_PATH }}/{{ APPLICATION_NAME }}_env; DB_MIGRATION_USER={{ DB_MIGRATION_USER }} DB_MIGRATION_PASS={{ DB_MIGRATION_PASS }} /edx/bin/python.{{ APPLICATION_NAME }} /edx/bin/manage.{{ APPLICATION_NAME }}" COMMAND_PREFIX: " . {{ APPLICATION_PATH }}/{{ APPLICATION_NAME }}_env; DB_MIGRATION_USER={{ DB_MIGRATION_USER }} DB_MIGRATION_PASS={{ DB_MIGRATION_PASS }} /edx/bin/python.{{ APPLICATION_NAME }} /edx/bin/manage.{{ APPLICATION_NAME }}"
...@@ -51,23 +51,23 @@ ...@@ -51,23 +51,23 @@
register: temp_output_dir register: temp_output_dir
- name: generate list of unapplied migrations - name: generate list of unapplied migrations
shell: '{{ COMMAND_PREFIX }} show_unapplied_migrations --output_file "{{ temp_output_dir.stdout }}/{{ unapplied_migrations_output }}"' shell: '{{ COMMAND_PREFIX }} show_unapplied_migrations --output_file "{{ temp_output_dir.stdout }}/{{ migration_plan }}"'
become_user: "{{ APPLICATION_USER }}" become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME != "edxapp" when: APPLICATION_NAME != "edxapp"
- name: generate list of edxapp unapplied migrations - name: generate list of edxapp unapplied migrations
shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} show_unapplied_migrations --database "{{ item }}" --output_file "{{ temp_output_dir.stdout }}/{{ item }}_{{ unapplied_migrations_output }}" --settings "{{ EDX_PLATFORM_SETTINGS }}"' shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} show_unapplied_migrations --database "{{ item }}" --output_file "{{ temp_output_dir.stdout }}/{{ item }}_{{ migration_plan }}" --settings "{{ EDX_PLATFORM_SETTINGS }}"'
become_user: "{{ APPLICATION_USER }}" become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME == "edxapp" and item != "read_replica" when: APPLICATION_NAME == "edxapp" and item != "read_replica"
with_items: edxapp_databases.keys() with_items: edxapp_databases.keys()
- name: migrate to apply any unapplied migrations - name: migrate to apply any unapplied migrations
shell: '{{ COMMAND_PREFIX }} run_migrations "{{ temp_output_dir.stdout }}/{{ unapplied_migrations_output }}" --output_file "{{ temp_output_dir.stdout }}/{{ migration_output }}"' shell: '{{ COMMAND_PREFIX }} run_migrations --output_file "{{ temp_output_dir.stdout }}/{{ migration_result }}"'
become_user: "{{ APPLICATION_USER }}" become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME != "edxapp" when: APPLICATION_NAME != "edxapp"
- name: migrate to apply any edxapp unapplied migrations - name: migrate to apply any edxapp unapplied migrations
shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} run_migrations "{{ temp_output_dir.stdout }}/{{ item }}_{{ unapplied_migrations_output }}" --database "{{ item }}" --settings "{{ EDX_PLATFORM_SETTINGS }}" --output_file "{{ temp_output_dir.stdout }}/{{ migration_output }}"' shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} run_migrations --database "{{ item }}" --settings "{{ EDX_PLATFORM_SETTINGS }}" --output_file "{{ temp_output_dir.stdout }}/{{ migration_result }}"'
become_user: "{{ APPLICATION_USER }}" become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME == "edxapp" and item != "read_replica" when: APPLICATION_NAME == "edxapp" and item != "read_replica"
with_items: edxapp_databases.keys() with_items: edxapp_databases.keys()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment