The information sent by the deployer is a bit convoluted which causes release-tools to thoroughly parse it and store it. For example, deployer can send:
["['\\n", " 20220510192117 Index expirable unknown artifacts for removal', '\\n", " 20220523171107 Drop deploy tokens token column']"]
Mayra Cabrerachanged title from Adjust the post-migration sent by deployer to release-tools to Adjust the post-migration information sent by deployer to release-tools
changed title from Adjust the post-migration sent by deployer to release-tools to Adjust the post-migration information sent by deployer to release-tools
@mayra-cabrera Now that I've had a good look through the way things are set up, the different jobs and projects, etc, I've made a start on improving some of the formatting specifically coming from the Ansible play itself so that release-tools doesn't have to do so much parsing.
Before going too far down any particular route, I'm wondering how "pre-formatted" we'd like the list of post-deployment migrations (PDMs) should be before it's POSTed to release-tools. Does anywhere currently - or could potentially in the future - use the info output by the play?
@mattfield I don't think this information will be used by the play, the main purpose of it is to be sent to release-tools so it can be stored and used later.
Dropping the down status is a great idea, it simplifies the output a lot! We just need to update release-tools to make it aware of that change since it uses that keyword as separator.
On the deployer side, could we modify the job script to only trigger a pipeline on release-tools if there are pending PDMs? Currently, we're triggering pipelines even when no PDMs are found (example).
@mayra-cabrera Thanks for the feedback! I'm working on an MR for release-tools at the moment.
Given that the PDMs are being spun out into their own pipeline and will be run manually in the future, is it still worth adding in a guard to the job script for safety's sake?
@mayra-cabrera Yes, exactly. Even though we're moving to have the separate PDM pipeline run manually by release managers for the time being it'll eventually be triggering automatically, so I reckon it's still worth spending the extra bit of effort to gate the extra processing from running ahead of the change.
@mattfield The pipeline that is triggered from deployer to release-tools is not the PDM pipeline though. This is one stores the pending post migrations info as an artifact to later be used by the PDM pipeline.
With that, I do think deployer should only trigger a release-tools pipeline with pending post-migrations:
Saves CI resources - Triggering a pipeline without pending post migrations means a pipeline, that is not doing anything, is triggered on every canary deployment, removing this one could lead to CI resource saving.
Facilitates debugging - Finding a specific job is easier when dealing with delimited concentration of pipelines. A lot of pipelines are being triggered daily on release-tools (gitlab.com) and release/tools (ops) due to the auto-deploy processes, for them we have some monitoring which makes these easier to track; but for the rest, you need to either use the pipeline UI or filter the logs using elastic search.
We could simplify the Artifact class scenarios to assume the class will be executed when post migrations are sent.
@mayra-cabrera Ah of course, that’s my mistake. Apologies Mayra, I’m still trying to piece together a lot of these moving parts which are quite tricky to thread together, so I’m conflating two separate workflows here (or conflating where they overlap at least)
As mentioned I do agree completely for all the reasons you have helpfully enumerated. Wondering whether we should gate at this stage was predicated on my incorrect knowledge about these pipelines. I’ll move onto that once the current tasks are tested and rounded off.
Thanks @mattfield! They're tricky indeed As discussed it may be better to postpone the gate at this stage, quoting from the slack conversation:
The problem Reuben and I discussed was that bypassing running the pipeline when there are no migrations would lead to an issue whereby post_deployment_migrations/pending.rb searching for the last execution would find a previous execution of the build job which did actually have pending migrations
With that, I think it's fine to move that part to another issue and close this one once we have tested the new changes in a PDM execution.