Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,6 @@ deploy-docs: venv
# The demo script requires to install asciinema with: brew install asciinema to run on mac os envs.
.PHONY: demo-update #EXHELP build demo
demo-update:
./hack/demo/generate-asciidemo.sh
./hack/demo/generate-asciidemo.sh -u -n catalogd-demo catalogd-demo-script.sh

include Makefile.venv
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ curl -k https://localhost:8081/catalogs/operatorhubio/api/v1/all | jq -s '.[] |
curl -k https://localhost:8081/catalogs/operatorhubio/api/v1/all | jq -s '.[] | select(.schema == "olm.channel") | select(.package == "wavefront") | .name'
# check what bundles are included in the wavefront package
curl -k https://localhost:8081/catalogs/operatorhubio/api/v1/all | jq -s '.[] | select(.schema == "olm.bundle") | select(.package == "wavefront") | .name'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It is OK, but we might want to have a complete demo instead of keep just for catalogd.
However, until there, why not? Who knows, we change the intention as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention here is that I'm creating demo scripts for the own/single namespace install mode feature, which I'll add to the demos directory. I'll probably add a Makefile at some point.

68 changes: 51 additions & 17 deletions hack/demo/generate-asciidemo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trap cleanup SIGINT SIGTERM EXIT

SCRIPTPATH="$( cd -- "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"

function check_prereq() {
check_prereq() {
prog=$1
if ! command -v ${prog} &> /dev/null
then
Expand All @@ -13,45 +13,79 @@ function check_prereq() {
fi
}

function cleanup() {
if [ -d $WKDIR ]
then
cleanup() {
if [[ -n "${WKDIR-}" && -d $WKDIR ]]; then
rm -rf $WKDIR
fi
}

function usage() {
echo "$0 [options]"
echo "where options is"
echo " h help (this message)"
usage() {
echo "$0 [options] <demo-script>"
echo ""
echo "options:"
echo " -n <name>"
echo " -u upload cast (default: false)"
echo " -h help (this message)"
echo ""
echo "examples:"
echo " # Generate asciinema demo described by gzip-demo-script.sh into gzip-demo-script.cast"
echo " $0 gzip-demo-script.sh"
echo ""
echo " # Generate asciinema demo described by demo-script.sh into catalogd-demo.cast"
echo " $0 -n catalogd-demo demo-script.sh"
echo ""
echo " # Generate and upload catalogd-demo.cast"
echo " $0 -u -n catalogd-demo demo-script.sh"
exit 1
}

set +u
while getopts 'h' flag; do
while getopts ':hn:u' flag; do
case "${flag}" in
h) usage ;;
h)
usage
;;
n)
DEMO_NAME="${OPTARG}"
;;
u)
UPLOAD=true
;;
:)
echo "Error: Option -${OPTARG} requires an argument."
usage
;;
\?)
echo "Error: Invalid option -${OPTARG}"
usage
;;
esac
shift
done
shift $((OPTIND - 1))
set -u

DEMO_SCRIPT="${1-}"

if [ -z $DEMO_SCRIPT ]; then
usage
fi

WKDIR=$(mktemp -d -t generate-asciidemo.XXXXX)
if [ ! -d ${WKDIR} ]
then
if [ ! -d ${WKDIR} ]; then
echo "unable to create temporary workspace"
exit 2
fi

for prereq in "asciinema curl"
do
for prereq in "asciinema curl"; do
check_prereq ${prereq}
done


curl https://raw.githubusercontent.com/zechris/asciinema-rec_script/main/bin/asciinema-rec_script -o ${WKDIR}/asciinema-rec_script
chmod +x ${WKDIR}/asciinema-rec_script
screencast=${WKDIR}/catalogd-demo.cast ${WKDIR}/asciinema-rec_script ${SCRIPTPATH}/demo-script.sh
screencast=${WKDIR}/${DEMO_NAME}.cast ${WKDIR}/asciinema-rec_script ${SCRIPTPATH}/${DEMO_SCRIPT}

asciinema upload ${WKDIR}/catalogd-demo.cast
if [ -n "${UPLOAD-}" ]; then
asciinema upload ${WKDIR}/${DEMO_NAME}.cast
fi

57 changes: 0 additions & 57 deletions hack/demo/generate-gzip-asciidemo.sh

This file was deleted.