Optimize rebuild to only restart containers whose images have actually changed. If only Ironic code changed, don't restart infrastructure services. This reduces rebuild time and avoids unnecessary service interruptions.
Goals
- Detect which images changed
- Restart only affected containers
- Skip unnecessary restarts
- Improve rebuild reliability
Implementation
Add image change detection to stackbox/core/builder.py:
def get_image_id(tag: str) -> Optional[str]:
"""Get image ID for a tag."""
result = subprocess.run(
["docker", "image", "inspect", tag, "--format", "{{.Id}}"],
capture_output=True,
text=True
)
return result.stdout.strip() if result.returncode == 0 else None
def image_changed(tag: str, old_id: str) -> bool:
"""Check if image changed."""
new_id = get_image_id(tag)
return new_id != old_id
Update rebuild command to track image IDs and only restart if changed.
Testing
# Make code change
stackbox rebuild ironic
# Should restart ironic containers
# No changes, rebuild
stackbox rebuild ironic
# Should detect no changes, skip restart
Acceptance Criteria
Resources
Optimize rebuild to only restart containers whose images have actually changed. If only Ironic code changed, don't restart infrastructure services. This reduces rebuild time and avoids unnecessary service interruptions.
Goals
Implementation
Add image change detection to
stackbox/core/builder.py:Update rebuild command to track image IDs and only restart if changed.
Testing
Acceptance Criteria
Resources