From 75ac47cdbb8c8f027431fc602dd39f106bbba4c3 Mon Sep 17 00:00:00 2001 From: Brian Ruf Date: Thu, 12 Nov 2026 18:12:18 +0000 Subject: [PATCH 1/2] Version bump and notes --- docs/ROADMAP.md | 2 +- docs/VERSION_HISTORY.md | 7 +++++++ oscal/_version.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 34e2ce9..54b57af 100755 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -5,7 +5,7 @@ The sequencing of releases may change in response to client needs and other external factors. -## CURRENT: Version 4.2.0 +## CURRENT: Version 4.2.1 - Profile import-selection authoring API — safer, granular control over an import's `include-controls` / `exclude-controls` and the `with-child-controls` flag: - `set_import_with_children()` toggles `with-child-controls` on the existing include/exclude selection independently, without rebuilding it. diff --git a/docs/VERSION_HISTORY.md b/docs/VERSION_HISTORY.md index 87b6ce6..d6936d8 100644 --- a/docs/VERSION_HISTORY.md +++ b/docs/VERSION_HISTORY.md @@ -87,3 +87,10 @@ - `preview_import_selection(href, ...)` — dry-run that returns the control ids a (committed or hypothetical) selection resolves to, so a caller can see what a `matching` glob actually selects before committing. - All import-selection setters remain staged, metaschema-validated, and atomic (a rejected edit rolls back and returns `None`). - CI: pinned the Python 3.9 test/lint matrix leg to `ubuntu-22.04` (`actions/setup-python` has no 3.9 build for Ubuntu ≥24.04, now the `ubuntu-latest` image). Python 3.9 support is unchanged this release; see `docs/5.0.0_PLANNING.md` for the planned drop of 3.9/3.10 and addition of 3.14. + +## Version 4.2.1 + +- additional methods for managing profile import control inclusion and exclusion directives + - original method is still available, but only provided coarse-grain control + - new methods allow targeted adjustments + diff --git a/oscal/_version.py b/oscal/_version.py index feddb23..f6847ee 100644 --- a/oscal/_version.py +++ b/oscal/_version.py @@ -8,4 +8,4 @@ so the build backend can read the literal without importing ``oscal`` (and its dependencies). """ -__version__ = "4.2.0" +__version__ = "4.2.1" From 3933623e36e596a4b9371bc0c48a5ebbc3ae1980 Mon Sep 17 00:00:00 2001 From: Brian Ruf Date: Thu, 12 Nov 2026 18:13:00 +0000 Subject: [PATCH 2/2] tagging scripts --- scripts/tag-release.cmd | 107 ++++++++++++++++++++++++++++++++++++++++ scripts/tag-release.sh | 91 ++++++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 scripts/tag-release.cmd create mode 100755 scripts/tag-release.sh diff --git a/scripts/tag-release.cmd b/scripts/tag-release.cmd new file mode 100644 index 0000000..5a5d9ec --- /dev/null +++ b/scripts/tag-release.cmd @@ -0,0 +1,107 @@ +@echo off +setlocal enabledelayedexpansion +REM tag-release.cmd -- safely tag a release and switch back automatically. +REM +REM Encapsulates the one workflow that requires being on the release branch +REM (default: main): tagging a release. Does checkout -> tag -> push -> +REM switch back as one sequence, so "forgot to switch back to the dev +REM branch afterward" stops being a failure mode that exists at all. +REM +REM Generic by design -- copy this file (and tag-release.sh) into any +REM repo's scripts\ folder. Nothing here names a specific repo, remote, or +REM branch beyond the configurable defaults below. +REM +REM Usage: +REM scripts\tag-release.cmd +REM e.g. scripts\tag-release.cmd v2.1.0 +REM +REM Configurable via environment variables (defaults shown): +REM RELEASE_BRANCH=main +REM REMOTE=origin + +if "%RELEASE_BRANCH%"=="" set "RELEASE_BRANCH=main" +if "%REMOTE%"=="" set "REMOTE=origin" + +if "%~1"=="" ( + echo Usage: %~nx0 ^ + echo e.g. %~nx0 v2.1.0 + exit /b 1 +) +set "TAG=%~1" + +git rev-parse --is-inside-work-tree >nul 2>&1 +if errorlevel 1 ( + echo error: not inside a git repository + exit /b 1 +) + +set "ORIGINAL_BRANCH=" +for /f "delims=" %%b in ('git symbolic-ref --short HEAD 2^>nul') do set "ORIGINAL_BRANCH=%%b" +if "%ORIGINAL_BRANCH%"=="" ( + echo error: not currently on a branch ^(detached HEAD^) -- aborting + exit /b 1 +) + +set "DIRTY=" +for /f "delims=" %%s in ('git status --porcelain') do set "DIRTY=1" +if defined DIRTY ( + echo error: you have uncommitted changes. Commit, stash, or discard them first. + exit /b 1 +) + +git rev-parse "%TAG%" >nul 2>&1 +if not errorlevel 1 ( + echo error: tag "%TAG%" already exists locally. + exit /b 1 +) + +echo ------------------------------------------------------------------- +echo About to tag a release: +echo Tag : %TAG% +echo Branch : %RELEASE_BRANCH% +echo Remote : %REMOTE% +echo Returning to : %ORIGINAL_BRANCH% +echo ------------------------------------------------------------------- +set "CONFIRM=" +set /p CONFIRM="Continue? [y/N] " +if /i "%CONFIRM%"=="y" goto :confirmed +if /i "%CONFIRM%"=="yes" goto :confirmed +echo Aborted -- no changes made. +exit /b 1 + +:confirmed +git fetch %REMOTE% --quiet +if errorlevel 1 goto :fail + +git checkout %RELEASE_BRANCH% +if errorlevel 1 goto :fail + +git pull --ff-only %REMOTE% %RELEASE_BRANCH% +if errorlevel 1 goto :restore_and_fail + +git ls-remote --exit-code %REMOTE% "refs/tags/%TAG%" >nul 2>&1 +if not errorlevel 1 ( + echo error: tag "%TAG%" already exists on %REMOTE%. + goto :restore_and_fail +) + +git tag -a "%TAG%" -m "Release %TAG%" +if errorlevel 1 goto :restore_and_fail + +git push %REMOTE% "%TAG%" +if errorlevel 1 goto :restore_and_fail + +echo ------------------------------------------------------------------- +echo Tagged and pushed %TAG% from %RELEASE_BRANCH%. +echo Switching back to %ORIGINAL_BRANCH%. +echo ------------------------------------------------------------------- +git checkout %ORIGINAL_BRANCH% +exit /b 0 + +:restore_and_fail +echo Restoring original branch %ORIGINAL_BRANCH% after failure... +git checkout %ORIGINAL_BRANCH% >nul 2>&1 + +:fail +echo tag-release failed. +exit /b 1 diff --git a/scripts/tag-release.sh b/scripts/tag-release.sh new file mode 100755 index 0000000..15601e3 --- /dev/null +++ b/scripts/tag-release.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# tag-release.sh -- safely tag a release and switch back automatically. +# +# Encapsulates the one workflow that requires being on the release branch +# (default: main): tagging a release. Does checkout -> tag -> push -> switch +# back as one sequence, so "forgot to switch back to the dev branch +# afterward" stops being a failure mode that exists at all. +# +# Generic by design -- copy this file (and tag-release.cmd) into any repo's +# scripts/ folder. Nothing here names a specific repo, remote, or branch +# beyond the configurable defaults below. +# +# Usage: +# scripts/tag-release.sh +# e.g. scripts/tag-release.sh v2.1.0 +# +# Configurable via environment variables (defaults shown): +# RELEASE_BRANCH=main +# REMOTE=origin + +set -euo pipefail + +RELEASE_BRANCH="${RELEASE_BRANCH:-main}" +REMOTE="${REMOTE:-origin}" + +if [ $# -ne 1 ]; then + echo "Usage: $0 " >&2 + echo " e.g. $0 v2.1.0" >&2 + exit 1 +fi +TAG="$1" + +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "error: not inside a git repository" >&2 + exit 1 +fi + +ORIGINAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null || true)" +if [ -z "$ORIGINAL_BRANCH" ]; then + echo "error: not currently on a branch (detached HEAD) -- aborting" >&2 + exit 1 +fi + +# Refuse with uncommitted changes: avoids any ambiguity about what ends up +# tagged, and avoids carrying local edits across the branch switch below. +if [ -n "$(git status --porcelain)" ]; then + echo "error: you have uncommitted changes. Commit, stash, or discard them first." >&2 + exit 1 +fi + +if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "error: tag '$TAG' already exists locally." >&2 + exit 1 +fi + +echo "-------------------------------------------------------------------" +echo " About to tag a release:" +echo " Tag : $TAG" +echo " Branch : $RELEASE_BRANCH" +echo " Remote : $REMOTE" +echo " Returning to : $ORIGINAL_BRANCH" +echo "-------------------------------------------------------------------" +read -r -p "Continue? [y/N] " REPLY +case "$REPLY" in + [yY]|[yY][eE][sS]) ;; + *) echo "Aborted -- no changes made."; exit 1 ;; +esac + +# Whatever happens from here, try to land back on the branch we started on. +cleanup() { + git checkout "$ORIGINAL_BRANCH" >/dev/null 2>&1 || true +} +trap cleanup EXIT + +git fetch "$REMOTE" --quiet +git checkout "$RELEASE_BRANCH" +git pull --ff-only "$REMOTE" "$RELEASE_BRANCH" + +if git ls-remote --exit-code "$REMOTE" "refs/tags/$TAG" >/dev/null 2>&1; then + echo "error: tag '$TAG' already exists on $REMOTE." >&2 + exit 1 +fi + +git tag -a "$TAG" -m "Release $TAG" +git push "$REMOTE" "$TAG" + +echo "-------------------------------------------------------------------" +echo " Tagged and pushed $TAG from $RELEASE_BRANCH." +echo " Switching back to $ORIGINAL_BRANCH..." +echo "-------------------------------------------------------------------" +# cleanup() above (registered via trap on EXIT) performs the checkout back.