Skip to content
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

Merged
merged 10 commits into from
Apr 10, 2018
Merged

Clone Old Versions When Updating Services #46

merged 10 commits into from
Apr 10, 2018

Conversation

seiffert
Copy link
Contributor

@seiffert seiffert commented Apr 6, 2018

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.

@seiffert seiffert force-pushed the clone_versions branch 4 times, most recently from d775b43 to b04bf2e Compare April 9, 2018 10:06
@seiffert seiffert force-pushed the clone_versions branch 3 times, most recently from b716d1a to 98d0743 Compare April 9, 2018 12:46
@seiffert
Copy link
Contributor Author

seiffert commented Apr 9, 2018

PTAL @Jimdo/werkzeugschmiede @boris-jarkowicz

@seiffert seiffert requested a review from fstehle April 9, 2018 13:48
Copy link
Contributor Author

@seiffert seiffert left a 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

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull out activate

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:
Copy link
Contributor Author

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

version_number = version['number']
return version['number']

def clone_old_version(self, service_id):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clone_active_version

'DELETE')
if response.status == 200:
return response.payload
else:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified

@smon smon merged commit 3c2db0f into master Apr 10, 2018
@smon smon deleted the clone_versions branch April 10, 2018 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants