openSUSE / ansible-obs

Some playbooks to operate OBS
1 stars 10 forks source link

The playbook deploy_with_migration.yml doesn't run pending migrations #65

Closed eduardoj closed 1 year ago

eduardoj commented 1 year ago

On the deployment of 2022-12-01 we noticed that the .rpm packages were already upgraded, but there were pending migrations.

We tried to use the deploy_with_migration.yml playbook, hoping that it would run the pending migrations. But it didn't. This was the output:

:~/ansible-obs> ansible-playbook -i inventory/production.yml deploy_with_migration.yml

PLAY [Deploy obs-api package] ****************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************
ok: [obs]

TASK [include_tasks] *************************************************************************************************************************************************************************
included: /home/eduardo/ansible-obs/includes/pending-migration.yml for obs

TASK [check for pending migrations] **********************************************************************************************************************************************************
changed: [obs -> localhost]

TASK [include_tasks] *************************************************************************************************************************************************************************
included: /home/eduardo/ansible-obs/includes/deployment-block.yml for obs

TASK [check if deployment is being blocked] **************************************************************************************************************************************************
changed: [obs -> localhost]

TASK [include_tasks] *************************************************************************************************************************************************************************
included: /home/eduardo/ansible-obs/includes/zypper-unlock.yml for obs

TASK [unlock obs-api] ************************************************************************************************************************************************************************
changed: [obs]

TASK [include_role : refresh_repositories] ***************************************************************************************************************************************************
skipping: [obs]

TASK [include_role : set_apache_maintenance_mode] ********************************************************************************************************************************************
skipping: [obs]

TASK [include_role : deploy] *****************************************************************************************************************************************************************
skipping: [obs]

TASK [include_role : run_migrations] *********************************************************************************************************************************************************
skipping: [obs]

TASK [include_role : enable_flipper_features_for_group] **************************************************************************************************************************************
skipping: [obs]

TASK [include_role : unset_apache_maintenance_mode] ******************************************************************************************************************************************
skipping: [obs]

TASK [include_tasks] *************************************************************************************************************************************************************************
skipping: [obs]

TASK [include_tasks] *************************************************************************************************************************************************************************
skipping: [obs]

PLAY RECAP ***********************************************************************************************************************************************************************************
obs                        : ok=7    changed=3    unreachable=0    failed=0    skipped=8    rescued=0    ignored=0   

:~/ansible-obs> 
danidoni commented 1 year ago

I guess the point here is that it's skipping: [obs] in TASK [include_role : run_migrations], right?

eduardoj commented 1 year ago

After having a look at the code with @saraycp we saw that the condition to start the task defined in deploy_with_migration.yml was not met: https://github.com/openSUSE/ansible-obs/blob/2317fafefd9a8a67a6626d943509b35476c8477d/deploy_with_migration.yml#L27

no_pending_migration was true. This variable keeps if there is code for performing a migration in the difference between the new package to be installed and the installed package. This behaviour is expected. Closing.