-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clone Old Versions When Updating Services #46
Conversation
d775b43
to
b04bf2e
Compare
delete all settings create all settings from scratch
b716d1a
to
98d0743
Compare
PTAL @Jimdo/werkzeugschmiede @boris-jarkowicz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed together with @smon
library/fastly_service.py
Outdated
actions.append("Deployed new version because settings are not up to date") | ||
version_number = self.clone_old_version(service.id) | ||
self.reset_version(service.id, version_number) | ||
self.configure_version(service.id, fastly_configuration, activate_new_version, version_number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull out activate
library/fastly_service.py
Outdated
if current_version is None: | ||
self.deploy_version_with_configuration(service.id, fastly_configuration, activate_new_version) | ||
actions.append("Deployed new version because service has no active version") | ||
if current_version is None or service.active_version is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add explicit branch for doing nothing
library/fastly_service.py
Outdated
version_number = version['number'] | ||
return version['number'] | ||
|
||
def clone_old_version(self, service_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clone_active_version
library/fastly_service.py
Outdated
'DELETE') | ||
if response.status == 200: | ||
return response.payload | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be simplified
This changes how new versions of already deployed services are created. Instead of creating a plain new version, the old one is cloned.
This original work was done by @joaopereiramrf in #43. I'm extracting the version cloning here, refactor it a bit and fix the tests.