fix(deploy): refresh env during image updates#395
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR closes an operational gap in the Ansible in-place upgrade flow by ensuring deploy/ansible/update.yml refreshes the rendered production env file before recreating services, and by wiring the per-service recreate task to append an upgrade-history entry as described in the upgrade runbook. It adds structural unit tests to prevent future drift.
Changes:
- Render
{{ musubi_config_dir }}/.env.productionduringupdate.ymlbefore thedocker_compose_v2recreate step (withno_log: true). - Add
notifyhooks on the per-servicedocker_compose_v2task to trigger the upgrade-history handlers. - Add structural tests asserting env refresh ordering and that the recreate task notifies the upgrade-history handlers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
deploy/ansible/update.yml |
Adds .env.production templating pre-recreate and ensures the recreate step notifies upgrade-history handlers. |
tests/ops/test_update_playbook.py |
Adds structural tests enforcing env refresh ordering and upgrade-history notification wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No tracking Issue: deploy exposed an update-playbook gap during the v1.11.4 rollout.
Summary
.env.productionduringdeploy/ansible/update.ymlbefore service recreation, soMUSUBI_SERVICE_VERSIONadvances with the pinned image/var/log/musubi/upgrade-history.jsonlas the runbook promisesValidation
uv run pytest tests/ops/test_update_playbook.py tests/ops/test_ansible.pyuv run ruff format --check tests/ops/test_update_playbook.pyuv run ruff check tests/ops/test_update_playbook.pyansible-playbook -i deploy/ansible/inventory.yml --syntax-check deploy/ansible/update.yml