lib/sysroot: Add OSTREE_EX_STAGE_DEPLOYMENTS environment variable
I feel like I'm drowning in a pile of experimental-but-almost-stable features... Anyways, since we made the feature opt-in in rpm-ostree in https://github.com/projectatomic/rpm-ostree/pull/1352 let's mirror that a bit here with an environment variable so people can play with it more easily. The tests needed some tweaks; specifically we need to reload the status fact after making changes. I'm still a bit uncertain about the Ansible-as-tests. But we add an upgrade test that uses the new environment variable. Closes: #1583 Approved by: jlebon
This commit is contained in:
1 parent
605d313206
commit
6873650cae
6 files changed
+60
-27
No files matched your search
@@ -27,16 +27,31 @@
|
||||
- name: Check that deploy-staged service worked
|
||||
shell: |
|
||||
set -xeuo pipefail
|
||||
rpm-ostree status
|
||||
# Assert that the previous boot had a journal entry for it
|
||||
journalctl -b "-1" -u ostree-finalize-staged.service | grep -q -e 'Transaction complete'
|
||||
# And there should not be a staged deployment
|
||||
test '!' -f /run/ostree/staged-deployment
|
||||
- name: Rollback
|
||||
shell: rpm-ostree rollback
|
||||
- include_tasks: ../tasks/reboot.yml
|
||||
- shell: |
|
||||
|
||||
- name: Upgrade with staging
|
||||
shell: |
|
||||
set -xeuo pipefail
|
||||
test '!' -f /run/ostree/staged-deployment
|
||||
ostree admin deploy --stage staged-deploy
|
||||
test -f /run/ostree/staged-deployment
|
||||
origcommit=$(ostree rev-parse staged-deploy)
|
||||
cd /ostree/repo/tmp
|
||||
ostree checkout -H "${origcommit}" t
|
||||
ostree commit --no-bindings --parent="${origcommit}" -b staged-deploy -I --consume t
|
||||
newcommit=$(ostree rev-parse staged-deploy)
|
||||
env OSTREE_EX_STAGE_DEPLOYMENTS=1 ostree admin upgrade >out.txt
|
||||
test -f /run/ostree/staged-deployment
|
||||
# Debating bouncing back out to Ansible for this
|
||||
firstdeploycommit=$(rpm-ostree status |grep 'Commit:' |head -1|sed -e 's,^ *Commit: *,,')
|
||||
test "${firstdeploycommit}" = "${newcommit}"
|
||||
# Cleanup
|
||||
rpm-ostree cleanup -rp
|
||||
- import_tasks: ../tasks/query-host.yml
|
||||
|
||||
# Ensure we can unstage
|
||||
- name: Write staged-deploy commit, then unstage
|
||||
@@ -50,8 +65,6 @@
|
||||
ostree admin status > status.txt
|
||||
grep -vqFe '(staged)' status.txt
|
||||
test '!' -f /run/ostree/staged-deployment
|
||||
environment:
|
||||
commit: "{{ rpmostree_status['deployments'][0]['checksum'] }}"
|
||||
|
||||
- name: Staged should be overwritten by non-staged
|
||||
shell: |
|
||||
|
||||
Reference in new issue
Block a user