Skip to content

Instantly share code, notes, and snippets.

@oglok
Last active January 4, 2023 17:52
Show Gist options
  • Save oglok/41f8d78e907f2458c2725b1a83e62b93 to your computer and use it in GitHub Desktop.
Save oglok/41f8d78e907f2458c2725b1a83e62b93 to your computer and use it in GitHub Desktop.
Upgrade/Rollback testbed
QUAY_USER=oglok
cd microshift
./scripts/image-builder/configure.sh
# Remove the call to cleanup script from build.sh
./scripts/image-builder/build.sh -pull_secret_file /etc/crio/openshift-pull-secret -ostree_server_name 192.168.122.1:8080
skopeo login quay.io -u $QUAY_USER -p $PASSWORD
skopeo copy oci-archive:_output/image-builder/microshift-container-0.0.1-container.tar docker://quay.io/$QUAY_USER/microshift-container:0.0.1
podman run --name edge-ostree-repo -d -p 8080:8080 --label io.containers.autoupdate=image quay.io/$QUAY_USER/microshift-container:0.0.1
# Install the recently created ISO by the IB script from our repo.
sudo cp _output/image-builder/microshift-installer-4.12.0-0.nightly-2022-12-16-075715.x86_64.iso /var/lib/libvirt/images/microshift-installer-0.0.1.iso
sudo virt-install --name microshift-device --vcpus 2 --memory 3072 --disk path=microshift-device.qcow2,size=20 --network network=default,model=virtio --os-type generic --events on_reboot=restart --cdrom /var/lib/libvirt/images/microshift-installer-0.0.1.iso
# Copy and modify the blueprint
cp scripts/image-builder/config/blueprint_v0.0.1.toml scripts/image-builder/config/blueprint_v0.0.2.toml
# Modify blueprint_v0.0.2.toml
# We have to build microshift RPMs again with some modification in case of testing rollback, backup of etcd, etc. So modify microshift, then make rpm, copy all _output/rpmbuild to _output/image-builder/microshift-local/ and then createrepo again.
sudo composer-cli blueprints push scripts/image-builder/config/blueprint_v0.0.2.toml
sudo composer-cli compose start-ostree --url http://192.168.122.1:8080/repo/ microshift-container edge-container
sudo composer-cli compose image $COMPOSEID
mv $COMPOSEID-container.tar microshift-container-0.0.2-container.tar
skopeo copy oci-archive:_output/image-builder/microshift-container-0.0.2-container.tar docker://quay.io/$QUAY_USER/microshift-container:0.0.2
sudo podman run --name microshift-container-server -d -p 8080:8080 --label io.containers.autoupdate=image quay.io/$QUAY_USER/microshift-container:0.0.2
# Now upgrade should be available
# In MicroShift's VM:
[root@microshift-device ~]# microshift version
MicroShift Version: 4.12.0_0.nightly_2023_01_03_161331_20230104062749_5efea5da_dirty
Base OCP Version: 4.12.0-0.nightly-2023-01-03-161331
[root@microshift-device ~]# rpm-ostree upgrade --preview
1 metadata, 0 content objects fetched; 169 B transferred in 0 seconds; 0 bytes content written
Note: --check and --preview may be unreliable. See https://github.com/coreos/rpm-ostree/issues/1579
AvailableUpdate:
Version: 8.7 (2023-01-04T17:11:19Z)
Commit: 661e9fe300a257ae2e049319c6b05f3d1c5960d7e5de328987f830e059af872f
Upgraded: microshift 4.12.0_0.nightly_2023_01_03_161331_20230104062749_5efea5da_dirty-1.el8 -> 4.12.0_0.nightly_2023_01_03_161331_20230104164756_ae2a2e2a_dirty-1.el8
microshift-networking 4.12.0_0.nightly_2023_01_03_161331_20230104062749_5efea5da_dirty-1.el8 -> 4.12.0_0.nightly_2023_01_03_161331_20230104164756_ae2a2e2a_dirty-1.el8
microshift-selinux 4.12.0_0.nightly_2023_01_03_161331_20230104062749_5efea5da_dirty-1.el8 -> 4.12.0_0.nightly_2023_01_03_161331_20230104164756_ae2a2e2a_dirty-1.el8
# Based on this article: https://www.redhat.com/en/blog/rhel-edge-update-infrastructure-quickstart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment