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

Void rolled back releases #1148

Merged
merged 1 commit into from
Feb 22, 2020

Conversation

tangrufus
Copy link
Collaborator

@tangrufus tangrufus commented Jan 22, 2020

Problem A

  1. deploy (current symlink to releases/11111111)
  2. deploy some changes (current symlink to releases/22222222)
  3. find out releases/22222222 is buggy; rollback (current symlink to releases/11111111)
  4. deploy bug fixes (current symlink to releases/33333333)
  5. find out releases/33333333 is also buggy; rollback (current symlink to releases/22222222)

We already know releases/22222222 is buggy and rolled back in step 3. However, Trellis doesn't know. Trellis rolls back to the last release which older than current

new_release_path: "{{ project_root }}/releases/{{ releases.stdout_lines[(current_release_position.stdout_lines[0] | int - 2)] }}"

Solution A

Write DEPLOY_UNFINISHED to release we move away from.


Problem B

If the last release which older than current contains DEPLOY_UNFINISH, rollback fails.

- name: Check whether target release was from a successful deploy
stat:
path: "{{ new_release_path }}/DEPLOY_UNFINISHED"
register: target

Solution B

Clean up old and failed (DEPLOY_UNFINISH) releases at the beginning of rollback.yml


Do we count this as beraking changes?

@swalkinshaw
Copy link
Member

What if we just deleted roll backed releases? The only downside I can think of is that if you decide to re-deploy a rolled back release it will just take a little longer since it's a full new deploy.

I'm guessing that's rare though since you usually roll back for a reason and apply a fix like you detailed.

@tangrufus
Copy link
Collaborator Author

What if we just deleted roll backed releases?

Do you mean replace https://github.com/roots/trellis/pull/1148/files#diff-1ff8e19172c2564b1d6f0cdc568feebdR28-R31 with something like $ rm -dfr {{ current_release_readlink_result.stdout }} (file module of course)?

The only downside I can think of is that if you decide to re-deploy a rolled back release it will just take a little longer since it's a full new deploy.

Not much differences in deploy speed I believe.
Because shared/source & composer caches are untouched by rollback.yml

@swalkinshaw
Copy link
Member

Yep exactly that. I don't know if this changes any of the assumptions in the prior/user release roles though.

@tangrufus tangrufus changed the title Void rolled back releases [WIP] Void rolled back releases Jan 22, 2020
@tangrufus tangrufus changed the title [WIP] Void rolled back releases Void rolled back releases Jan 22, 2020
@tangrufus
Copy link
Collaborator Author

tangrufus commented Jan 22, 2020

Note that 0c2dd89 might delete more releases than you expected.

During Clean up old and failed releases, ansible keep_releases: "{{ project.deploy_keep_releases | default(deploy_keep_releases | default(omit)) }}"
Then, at the end of rollback (Remove the old symlinked release), ansible delete 1 more.
Thus, you will have max deploy_keep_releases - 1 releases after rollback.


I don't know if this changes any of the assumptions in the prior/user release roles though.

They should work, i.e: look for the newest good (i.e: deploy was successful & never been rolled back) release which older than current

@swalkinshaw
Copy link
Member

Seems ok to me. What do you think of the delete method vs the other one?

@tangrufus
Copy link
Collaborator Author

tangrufus commented Jan 28, 2020

I suggest we keep the rolled back release instead of deleteing it, i.e: revert 0c2dd89

Reasons:

Only thing I don't like is hardcoding DEPLOY_UNFINISHED. But I don't find a good solution to keep it in sync with deploy_helper.unfinished_filename (in deploy.yml).

@swalkinshaw
Copy link
Member

Sounds good to me 👍

@tangrufus
Copy link
Collaborator Author

tangrufus commented Jan 28, 2020

Dropped 0c2dd89 & rebased onto master & added changelog

@tangrufus
Copy link
Collaborator Author

rebased, ready for review

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