Skip to content

Commit b87461c

Browse files
committed
revert: keep the core pin in mise.toml
This reverts 7ce1a6b and 380ee70. buf.gen.yaml without plugins can't be used by buf directly; it only held the pin for yq to parse. OPENSHELL_CORE_REF in mise.toml stays the single pin, and fetch-core.sh fetches the fixtures. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
1 parent 380ee70 commit b87461c

5 files changed

Lines changed: 64 additions & 52 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828

2929
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
3030

31-
# proto:check and conformance:check read proto/ and sdk/conformance from
32-
# NVIDIA/OpenShell at the tag pinned in buf.gen.yaml (public, no credentials).
31+
# fetch-core.sh reads proto/ and sdk/conformance from NVIDIA/OpenShell
32+
# at the pinned ref (public, no credentials).
3333
- name: Format, lint, typecheck, proto and fixture drift
3434
run: mise run check
3535

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ mise run core:version
2828

2929
## Core version and generated bindings
3030

31-
The bindings are generated from `proto/` in NVIDIA/OpenShell at the tag pinned
32-
in `buf.gen.yaml` (`inputs[0].tag`, currently `v0.1.7`), the same file and
33-
field sdk-go uses, and committed under `src/openshell/_proto`. `buf export`
34-
fetches the protos and `grpcio-tools` generates the bindings:
31+
The bindings are generated from `proto/` in NVIDIA/OpenShell at the ref in
32+
`OPENSHELL_CORE_REF` (`mise.toml`, currently `v0.1.7`) and committed under
33+
`src/openshell/_proto`. `buf export` fetches the protos, the same way sdk-go
34+
reads them, and `grpcio-tools` generates the bindings:
3535

3636
- Building a wheel or sdist needs neither a core checkout nor network access.
3737
- A change of the pin shows the effect on the generated API in its diff.

‎buf.gen.yaml‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎mise.toml‎

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,45 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Python SDK tasks. Run `mise tasks` to list them and `mise run ci` for the
5-
# full pipeline. Bindings are generated from core's proto/ at the release tag
6-
# pinned in buf.gen.yaml (inputs[0].tag) and committed under
7-
# src/openshell/_proto, so building the package needs no core checkout and no
8-
# network.
5+
# full pipeline. Bindings are generated from core's proto/ at the ref pinned in
6+
# OPENSHELL_CORE_REF and committed under src/openshell/_proto, so building the
7+
# package needs no core checkout and no network.
98

109
min_version = { soft = "2026.9.9" }
1110

1211
[tools]
1312
python = "3.14.5"
1413
buf = "1.72.0"
1514
uv = "0.10.12"
16-
yq = "4.53.6"
1715

1816
[env]
17+
# The single core pin: a release tag (or a full commit SHA).
18+
OPENSHELL_CORE_REF = "v0.1.7"
1919
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0"
2020

2121
[vars]
2222
python_paths = "src/ tests/ scripts/"
2323

2424
[tasks."core:version"]
25-
description = "Print the core release tag the bindings are pinned to"
26-
run = "yq -r '.inputs[0].tag' buf.gen.yaml"
25+
description = "Print the pinned core ref"
26+
run = "echo $OPENSHELL_CORE_REF"
2727

2828
[tasks.sync]
2929
description = "Install the SDK and its development dependencies"
3030
run = "uv sync --frozen --group dev"
3131

3232
[tasks."proto:fetch"]
33-
description = "Export the SDK's protos from core at the pinned tag into proto/"
34-
# buf follows the imports of the files in inputs[0].paths, so proto/ holds
35-
# exactly the files the SDK compiles.
33+
description = "Export the SDK's protos from core at the pinned ref into proto/"
34+
# buf follows the imports of the two root files, so proto/ holds exactly the
35+
# files the SDK compiles.
3636
run = """
3737
#!/usr/bin/env bash
3838
set -euo pipefail
39-
input() { yq -r ".inputs[0].$1" buf.gen.yaml; }
40-
paths=()
41-
while read -r path; do paths+=(--path "$path"); done < <(yq -r '.inputs[0].paths[]' buf.gen.yaml)
4239
rm -rf proto
43-
buf export "$(input git_repo)#tag=$(input tag),depth=$(input depth),subdir=$(input subdir)" \
44-
"${paths[@]}" --output proto
40+
buf export "https://github.com/NVIDIA/OpenShell.git#ref=${OPENSHELL_CORE_REF},depth=1,subdir=proto" \
41+
--path openshell.proto --path credential_driver.proto --output proto
4542
"""
46-
sources = ["buf.gen.yaml"]
43+
sources = ["mise.toml"]
4744
outputs = ["proto/openshell.proto"]
4845

4946
[tasks."proto:gen"]
@@ -65,16 +62,15 @@ fi
6562
"""
6663

6764
[tasks."conformance:check"]
68-
description = "Fail if vendored fixtures differ from core at the pinned tag"
65+
description = "Fail if vendored fixtures differ from core at the pinned ref"
6966
run = """
7067
#!/usr/bin/env bash
7168
set -euo pipefail
72-
# Shared cross-SDK fixtures live in core's sdk/conformance/. The copies in
73-
# tests/fixtures must match core at the pinned tag.
74-
TAG=$(yq -r '.inputs[0].tag' buf.gen.yaml)
75-
BASE="https://raw.githubusercontent.com/NVIDIA/OpenShell/$TAG/sdk/conformance"
69+
core=$(mktemp -d)
70+
trap 'rm -rf "$core"' EXIT
71+
scripts/fetch-core.sh "$OPENSHELL_CORE_REF" "$core" sdk/conformance
7672
for fixture in oauth-client-credentials.json oauth-client-credentials.json.license; do
77-
curl -fsSL "$BASE/$fixture" | diff -u - "tests/fixtures/$fixture"
73+
diff -u "$core/sdk/conformance/$fixture" "tests/fixtures/$fixture"
7874
done
7975
"""
8076

‎scripts/fetch-core.sh‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# fetch-core.sh: copy files from NVIDIA/OpenShell at a pinned ref.
6+
#
7+
# The protos come from `buf export` (mise run proto:fetch); this script fetches
8+
# the other core files the repository checks against, such as the vendored
9+
# conformance fixtures.
10+
#
11+
# Usage: fetch-core.sh <ref> <out-dir> <core-path>...
12+
#
13+
# Fetches only <ref> (a tag or a full commit SHA), without history or unneeded
14+
# blobs, and copies each <core-path> (a file or directory) into <out-dir>
15+
# under the same relative path, replacing what was there.
16+
set -euo pipefail
17+
18+
if [ $# -lt 3 ]; then
19+
echo "usage: $0 <ref> <out-dir> <core-path>..." >&2
20+
exit 2
21+
fi
22+
23+
ref=$1
24+
out=$2
25+
shift 2
26+
remote=${OPENSHELL_CORE_REMOTE:-https://github.com/NVIDIA/OpenShell.git}
27+
work=$(mktemp -d)
28+
trap 'rm -rf "$work"' EXIT
29+
30+
git -C "$work" init --quiet
31+
git -C "$work" remote add origin "$remote"
32+
git -C "$work" fetch --quiet --depth 1 --filter=blob:none --no-tags origin "$ref"
33+
git -C "$work" sparse-checkout set --no-cone "$@"
34+
git -C "$work" checkout --quiet FETCH_HEAD
35+
36+
for path in "$@"; do
37+
rm -rf "${out:?}/$path"
38+
mkdir -p "$out/$(dirname "$path")"
39+
cp -R "$work/$path" "$out/$path"
40+
done

0 commit comments

Comments
 (0)