refactor!: Rename template to generate and move rebase/upgrade under switch (#116)

This updates the `template` subcommand to be `generate`. The `template`
usage will continue to work as an alias to `generate`. A new `switch`
command is added that will manage both `rpm-ostree rebase` and
`rpm-ostree upgrade` and is fully replacing the respective subcommands
as a breaking change.

The new `switch` command is under the feature flag `switch` and will
currently only build for the `main` branch builds until it is moved as a
default feature (`v0.9.0`).

Closes #159
This commit is contained in:
Gerald Pinder 2024-05-26 22:47:34 -04:00 committed by GitHub
parent 968cf3db97
commit 02b2fe5434
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 672 additions and 62 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
print_version_json() {
local version="1.24.0"
@ -8,6 +8,11 @@ print_version_json() {
main() {
if [[ "$1" == "version" && "$2" == "--json" ]]; then
print_version_json
elif [[ "$1" == "build" && "$6" == *"cli_test.tar.gz" ]]; then
tarpath=$(echo "$6" | awk -F ':' '{print $2}')
echo "Exporting image to a tarball (JK JUST A MOCK!)"
echo "${tarpath}"
touch $tarpath
else
echo 'Running buildah'
fi

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
print_version_json() {
local version="4.0.0"
@ -8,6 +8,11 @@ print_version_json() {
main() {
if [[ "$1" == "version" && "$2" == "-f" && "$3" == "json" ]]; then
print_version_json
elif [[ "$1" == "build" && "$6" == *"cli_test.tar.gz" ]]; then
tarpath=$(echo "$6" | awk -F ':' '{print $2}')
echo "Exporting image to a tarball (JK JUST A MOCK!)"
echo "${tarpath}"
touch $tarpath
else
echo 'Running podman'
fi

View file

@ -1,9 +1,7 @@
#!/bin/sh
#!/bin/bash
set -euo pipefail
echo 'Running rpm-ostree'
if [ "$1" = "rebase" ]; then
if [ "$2" = "ostree-unverified-image:oci-archive:$BB_TEST_LOCAL_IMAGE" ]; then
echo "Rebased to local image $BB_TEST_LOCAL_IMAGE"
@ -13,6 +11,23 @@ if [ "$1" = "rebase" ]; then
fi
elif [ "$1" = "upgrade" ]; then
echo "Performing upgrade for $BB_TEST_LOCAL_IMAGE"
elif [ "$1" = "status" ]; then
cat <<EOF
{
"deployments": [
{
"container-image-reference": "ostree-image-signed:docker://ghcr.io/blue-build/cli/test",
"booted": true,
"staged": false
},
{
"container-image-reference": "ostree-image-signed:docker://ghcr.io/blue-build/cli/test:last",
"booted": false,
"staged": false
}
]
}
EOF
else
echo "Arg $1 is not recognized"
exit 1