From 6e1371ab51de46f2497c4fb992e4851faeb243be Mon Sep 17 00:00:00 2001 From: David Crespo Date: Tue, 15 Sep 2026 14:10:36 -0500 Subject: [PATCH] gen-api-latest script to bump API to latest omicron main --- OMICRON_VERSION | 2 +- app/api/__generated__/Api.ts | 9 ++++---- app/api/__generated__/OMICRON_VERSION | 2 +- package.json | 1 + tools/gen_api_latest.sh | 33 +++++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100755 tools/gen_api_latest.sh diff --git a/OMICRON_VERSION b/OMICRON_VERSION index 001518686..f10bcfe60 100644 --- a/OMICRON_VERSION +++ b/OMICRON_VERSION @@ -1 +1 @@ -6deb5ffe34c4227f516a882ee8781153cd12d6c2 +a14e6bb877451f7307ced4b079c298855cb974dc diff --git a/app/api/__generated__/Api.ts b/app/api/__generated__/Api.ts index aeb541233..5e1516ba1 100644 --- a/app/api/__generated__/Api.ts +++ b/app/api/__generated__/Api.ts @@ -3902,10 +3902,11 @@ export type VpcCreateDefaults = { /** * Default resources to create in a VPC */ -export type VpcCreateDefaultsSelection = /** Create all default resources */ -| { type: 'all' } -/** Create only the default resources listed in `defaults`. Pass `{}` as `defaults` to skip them all. */ -| { defaults: VpcCreateDefaults; type: 'explicit' } +export type VpcCreateDefaultsSelection = + /** Create all default resources */ + | { type: 'all' } + /** Create only the default resources listed in `defaults`. Pass `{}` as `defaults` to skip them all. */ + | { defaults: VpcCreateDefaults; type: 'explicit' } /** * Default resources to create in a project diff --git a/app/api/__generated__/OMICRON_VERSION b/app/api/__generated__/OMICRON_VERSION index e9e8abd4b..5c6066821 100644 --- a/app/api/__generated__/OMICRON_VERSION +++ b/app/api/__generated__/OMICRON_VERSION @@ -1,2 +1,2 @@ # generated file. do not update manually. see docs/update-pinned-api.md -6deb5ffe34c4227f516a882ee8781153cd12d6c2 +a14e6bb877451f7307ced4b079c298855cb974dc diff --git a/package.json b/package.json index d39946440..8c3aebd3b 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "fmt:check": "oxfmt --check", "openapi-gen-ts": "openapi-gen-ts", "gen-api": "./tools/generate_api_client.sh", + "gen-api-latest": "./tools/gen_api_latest.sh", "postinstall": "patch-package", "prepare": "husky" }, diff --git a/tools/gen_api_latest.sh b/tools/gen_api_latest.sh new file mode 100755 index 000000000..9f60b394a --- /dev/null +++ b/tools/gen_api_latest.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# Copyright Oxide Computer Company + +# Like `npm run gen-api`, but first pins OMICRON_VERSION to the latest omicron +# main commit (or the commit at an optional ref passed as the first argument). +# See docs/update-pinned-api.md. + +set -o errexit +set -o pipefail + +REF="${1:-main}" + +OLD_SHA=$(head -n 1 OMICRON_VERSION) +NEW_SHA=$(curl --fail --silent --show-error \ + "https://api.github.com/repos/oxidecomputer/omicron/commits/$REF" | jq -r '.sha') + +if [[ ! "$NEW_SHA" =~ ^[0-9a-f]{40}$ ]]; then + echo "Could not resolve omicron ref '$REF' to a commit hash" >&2 + exit 1 +fi + +if [[ "$NEW_SHA" == "$OLD_SHA" ]]; then + echo "OMICRON_VERSION already at $NEW_SHA" +else + echo "Updating OMICRON_VERSION: $OLD_SHA -> $NEW_SHA" + echo "$NEW_SHA" > OMICRON_VERSION +fi + +npm run gen-api