Skip to content

Instantly share code, notes, and snippets.

@nzwulfin
Created September 19, 2016 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzwulfin/91dab312d35e103641b3bebb739da8b0 to your computer and use it in GitHub Desktop.
Save nzwulfin/91dab312d35e103641b3bebb739da8b0 to your computer and use it in GitHub Desktop.
Manual test: synthetic upgrade and rollback target with ostree commit
## Set up new branch based on existing tree and deploy
sudo ostree commit -b synthetic_test --tree=ref=fedora-atomic:fedora-atomic/24/x86_64/docker-host | tee target_commit.txt
sudo ostree admin deploy synthetic_test
sudo systemctl reboot
atomic host status
<active commit == target_commit.txt>
## Create a 'noop' commit based on the new branch as an upgrade target
sudo ostree commit -b synthetic_test --tree=ref=synthetic_test | tee target_upgrade.txt
sudo atomic host upgrade
sudo systemctl reboot
atomic host status
<active commit == target_upgrade.txt>
## Rollback to new branch
sudo atomic host rollback
sudo systemctl reboot
atomic host status
<active commit == target_commit.txt>
@jlebon
Copy link

jlebon commented Sep 19, 2016

If you're planning to transform this to Python, consider using the output of rpm-ostree status --json instead (though I think the atomic host wrapper also supports --json) to retrieve the current ref you're sitting on, rather than hardcoding it.

@nzwulfin
Copy link
Author

@jlebon, yes that will help a lot for parsing. Will investigate for current atomic and rpm-ostree support for json output. That will also be easier to determine which commit id is booted, etc.

@nzwulfin
Copy link
Author

python synth_setup.py && atomic host status
sudo systemctl reboot

python synth_upgrade.py && atomic host status
sudo systemctl reboot

python synth_rollback.py && atomic host status
sudo systemctl reboot

@jlebon
Copy link

jlebon commented Sep 21, 2016

Tests look sane. I'd add a follow-up check that the commit you rolled back to is indeed what you expect it to be.
Also note that instead of ostree admin deploy, you can use rpm-ostree rebase $ref, which also has a --reboot option. (All the other rpm-ostree commands used here also have a similar --reboot option, which might simplify your life).

@nzwulfin
Copy link
Author

I'm rethinking the setup portion to create the new tree, deploy it, create the updated tree, then reboot

This seems to work the way we'll need it to in Tunir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment