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
7 changes: 6 additions & 1 deletion .github/scripts/openshell-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
# current shell. In GitHub Actions it also exports them to GITHUB_ENV
# for downstream steps.
#
# OPENSHELL_VERSION is tracked by Renovate via a customManager in
# renovate.json (not this file's magic comments — a bare "# renovate:"
# comment here would be inert since no built-in manager scans .sh files).
# OPENSHELL_SHA is refreshed automatically after each version bump by
# scripts/renovate/update-openshell-sha.sh (see renovate.json postUpgradeTasks).
#
# Usage:
# source .github/scripts/openshell-version.sh

# renovate: datasource=github-releases depName=NVIDIA/OpenShell
OPENSHELL_VERSION=0.0.83
OPENSHELL_SHA=e3d26dd3ae0dee247bbc5db368545832757ac493

Expand Down
11 changes: 11 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ source URL for checksums. When bumping a version:
3. The base image digest can be updated by running
`podman manifest inspect <image>:<tag>` and extracting the index digest.

OpenShell is partially automated: `OPENSHELL_VERSION` is tracked by a
Renovate customManager, and `OPENSHELL_SHA` (the commit SHA used by
`.github/scripts/install-openshell.sh` to pin the upstream installer on CI
host runners) is refreshed automatically by
`scripts/renovate/update-openshell-sha.sh` via `postUpgradeTasks` after each
version bump. The runner Containerfile's OpenShell install is independent —
it downloads the release tarball by version and verifies it with
`sha256sum -c` against the release checksums file (see the table above).
See `.github/scripts/openshell-version.sh` for the version/SHA source of
truth.

## Local builds

Build for your native architecture:
Expand Down
14 changes: 10 additions & 4 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@
"enabled": false
},
{
"description": "Group OpenShell base image and version pin into one PR",
"description": "Group OpenShell base image and version pin into one PR. After a version bump, fetch and update OPENSHELL_SHA from the matching release tag (the github-releases datasource can't resolve a digest here because extractVersionTemplate strips the 'v' prefix that GitHub's tag lookup needs).",
"matchPackageNames": [
"ghcr.io/nvidia/openshell-community/sandboxes/base",
"NVIDIA/OpenShell"
],
"groupName": "openshell"
"groupName": "openshell",
"automerge": false,
"postUpgradeTasks": {
"commands": ["bash scripts/renovate/update-openshell-sha.sh"],
"fileFilters": [".github/scripts/openshell-version.sh"],
"executionMode": "branch"
}
},
{
"description": "Group Cloudflare Worker packages to prevent broken lockfile-only PRs from peer dependency conflicts",
Expand Down Expand Up @@ -67,10 +73,10 @@
"customManagers": [
{
"customType": "regex",
"description": "Track OpenShell version pin in openshell-version.sh",
"description": "Track the OpenShell version pin in openshell-version.sh. OPENSHELL_SHA is updated automatically by postUpgradeTasks (scripts/renovate/update-openshell-sha.sh) since the github-releases datasource can't resolve a digest for the version-only (no 'v' prefix) value produced by extractVersionTemplate.",
"managerFilePatterns": ["/^\\.github/scripts/openshell-version\\.sh$/"],
"matchStrings": [
"OPENSHELL_VERSION=(?<currentValue>\\d+\\.\\d+\\.\\d+)\\nOPENSHELL_SHA=(?<currentDigest>[0-9a-f]{40})"
"OPENSHELL_VERSION=(?<currentValue>\\d+\\.\\d+\\.\\d+)"
],
"depNameTemplate": "NVIDIA/OpenShell",
"datasourceTemplate": "github-releases",
Expand Down
57 changes: 57 additions & 0 deletions scripts/renovate/update-openshell-sha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Called by Renovate postUpgradeTasks after an OpenShell version bump.
#
# The github-releases datasource can't resolve a digest for OPENSHELL_SHA
# directly: Renovate's digest lookup compares the new value against raw
# GitHub tag names (e.g. "v0.0.103"), but extractVersionTemplate strips the
# "v" prefix from the value tracked in this file (e.g. "0.0.103"), so the
# comparison never matches. Instead, this script looks up the commit SHA
# for the release tag directly and patches it in.
set -euo pipefail

FILE=".github/scripts/openshell-version.sh"

OLD_VERSION=$(git show HEAD:"${FILE}" | grep -oP '^OPENSHELL_VERSION=\K\S+' || true)
NEW_VERSION=$(grep -oP '^OPENSHELL_VERSION=\K\S+' "${FILE}" || true)

if [[ -z "${NEW_VERSION}" ]]; then
echo "error: could not extract OPENSHELL_VERSION from working-tree ${FILE}" >&2
exit 1
fi
if [[ ! "${NEW_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "error: NEW_VERSION is not a valid semver: ${NEW_VERSION}" >&2
exit 1
fi

if [[ "${OLD_VERSION}" == "${NEW_VERSION}" ]]; then
echo "OpenShell version unchanged (${NEW_VERSION}), nothing to do"
exit 0
fi

echo "OpenShell: ${OLD_VERSION:-<none>} -> ${NEW_VERSION}"

WORKDIR="$(mktemp -d)"
trap 'rm -rf "${WORKDIR}"' EXIT

curl -fsSL "https://api.github.com/repos/NVIDIA/OpenShell/commits/v${NEW_VERSION}" \
Comment thread
ralphbean marked this conversation as resolved.
Resolved
Comment thread
ralphbean marked this conversation as resolved.
Resolved
-o "${WORKDIR}/commit.json"
Comment thread
ralphbean marked this conversation as resolved.
Resolved
Comment thread
ralphbean marked this conversation as resolved.
Resolved
SHA=$(jq -r '.sha // empty' "${WORKDIR}/commit.json")
Comment thread
ralphbean marked this conversation as resolved.
Resolved
Comment thread
ralphbean marked this conversation as resolved.
Resolved

if [[ ! "${SHA}" =~ ^[0-9a-f]{40}$ ]]; then
echo "error: resolved SHA is not a valid 40-char hex commit sha: ${SHA}" >&2
exit 1
fi

if ! grep -q "^OPENSHELL_SHA=" "${FILE}"; then
echo "error: no OPENSHELL_SHA line found in ${FILE}" >&2
exit 1
fi

sed -i "s/^OPENSHELL_SHA=.*/OPENSHELL_SHA=${SHA}/" "${FILE}"

if ! grep -q "^OPENSHELL_SHA=${SHA}$" "${FILE}"; then
echo "error: failed to update OPENSHELL_SHA in ${FILE}" >&2
exit 1
fi

echo "updated OPENSHELL_SHA to ${SHA} for v${NEW_VERSION}"
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
Loading