Skip to content

Commit

Permalink
Script to automatically bump omicron (#942)
Browse files Browse the repository at this point in the history
* script to automatically bump omicron

* better logic for failing on non-main commits

* check that omicron is in the right spot

* shellcheck

* add description at the top

* use short commit hash to avoid branch name collisions
  • Loading branch information
david-crespo authored Jun 17, 2022
1 parent 09657b0 commit fa7edc6
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tools/bump-omicron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Automatically update tools/console_version in ../omicron with current console
# commit hash and tarball hash. Then create PR in Omicron with that change.
#
# Requirements/assumptions:
#
# - GitHub CLI
# - Omicron is a sibling dir to console

set -o errexit
set -o pipefail

if ! command -v gh &> /dev/null; then
echo "Error: GitHub CLI not found. This script needs it to create a PR. Please install it and try again."
exit
fi

if [ ! -d "../omicron" ]; then
echo "Error: This script assumes omicron shares a parent directory with console."
exit
fi

# note that this will fail unless the current console commit has a release on
# dl.oxide.computer, i.e., it is a commit on main that has been pushed to GH.
CONSOLE_VERSION=$(git rev-parse HEAD)
# short hash used in branch name to avoid collisions
CONSOLE_VERSION_SHORT=$(git rev-parse --short HEAD)
SHA2=$(curl --fail-with-body "https://dl.oxide.computer/releases/console/$CONSOLE_VERSION.sha256.txt")

cd ../omicron
git checkout main
git pull
git checkout -b "bump-console-$CONSOLE_VERSION_SHORT"

cat <<EOF > tools/console_version
COMMIT="$CONSOLE_VERSION"
SHA2="$SHA2"
EOF

git add --all
git commit -m "Bump console to latest main"
gh pr create --fill --web

1 comment on commit fa7edc6

@vercel
Copy link

@vercel vercel bot commented on fa7edc6 Jun 17, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.