From ffe03508eaa17022f34429e3c57d05d504e88357 Mon Sep 17 00:00:00 2001 From: Twangboy Date: Mon, 26 Oct 2026 09:54:52 -0600 Subject: [PATCH 1/2] Update release requirements and remove boto3 Drop boto3 and the unused s3-publish tool, bump certifi and pip (pinned via --allow-unsafe) and refresh all other pins. --- .pre-commit-config.yaml | 1 + requirements/release.in | 3 +- requirements/release.txt | 73 +++++++++---------- tools/__init__.py | 3 +- tools/release.py | 148 --------------------------------------- tools/utils.py | 80 --------------------- 6 files changed, 38 insertions(+), 270 deletions(-) delete mode 100644 tools/release.py delete mode 100644 tools/utils.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c82c9bab..cd87279ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,6 +35,7 @@ repos: - id: pip-compile files: ^requirements/release\.(in|txt)$ args: + - --allow-unsafe - requirements/release.in - repo: https://github.com/asottile/pyupgrade diff --git a/requirements/release.in b/requirements/release.in index b92c1c3b2..56baafe25 100644 --- a/requirements/release.in +++ b/requirements/release.in @@ -1,6 +1,7 @@ -boto3 +certifi >= 2026.10.19 filelock >= 3.20.3 idna >= 3.15 +pip >= 26.2.2 pre-commit pygments >= 2.20.0 python-tools-scripts >= 0.18.6 diff --git a/requirements/release.txt b/requirements/release.txt index 67828f591..c36462bcb 100644 --- a/requirements/release.txt +++ b/requirements/release.txt @@ -2,88 +2,83 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile requirements/release.in +# pip-compile --allow-unsafe requirements/release.in # -annotated-types==0.7.0 + +annotated-types==0.8.0 # via pydantic -attrs==24.3.0 +attrs==26.1.0 # via python-tools-scripts -boto3==1.35.98 - # via -r requirements/release.in -botocore==1.35.98 +certifi==2026.10.19 # via - # boto3 - # s3transfer -certifi==2024.12.14 - # via requests -cfgv==3.4.0 + # -r requirements/release.in + # requests +cfgv==3.5.0 # via pre-commit -charset-normalizer==3.4.1 +charset-normalizer==3.5.2 # via requests -distlib==0.3.9 +distlib==0.4.4 # via virtualenv -filelock==4.0.3 +filelock==4.2.4 # via # -r requirements/release.in # python-discovery # python-tools-scripts # virtualenv -identify==2.6.5 +identify==2.6.20 # via pre-commit -idna==3.15 +idna==3.20 # via # -r requirements/release.in # requests -jmespath==1.0.1 - # via - # boto3 - # botocore -markdown-it-py==3.0.0 +markdown-it-py==4.2.0 # via rich mdurl==0.1.2 # via markdown-it-py -nodeenv==1.9.1 +nodeenv==1.11.0 # via pre-commit -platformdirs==4.3.6 +packaging==26.3 + # via virtualenv +platformdirs==4.13.5 # via virtualenv -pre-commit==4.0.1 +pre-commit==4.7.0 # via -r requirements/release.in -pydantic==2.10.5 +pydantic==2.14.1 # via python-tools-scripts -pydantic-core==2.27.2 +pydantic-core==2.50.1 # via pydantic -pygments==2.20.0 +pygments==2.21.0 # via # -r requirements/release.in # rich -python-dateutil==2.9.0.post0 - # via botocore -python-discovery==1.6.1 +python-discovery==1.6.4 # via virtualenv python-tools-scripts==0.20.5 # via -r requirements/release.in -pyyaml==6.0.2 +pyyaml==6.0.3 # via pre-commit requests==2.34.2 # via # -r requirements/release.in # python-tools-scripts -rich==13.9.4 +rich==15.0.0 # via python-tools-scripts -s3transfer==0.10.4 - # via boto3 -six==1.17.0 - # via python-dateutil -typing-extensions==4.15.0 +typing-extensions==4.16.0 # via # pydantic # pydantic-core + # typing-inspection +typing-inspection==0.4.4 + # via pydantic urllib3==2.8.0 # via # -r requirements/release.in - # botocore # requests -virtualenv==21.13.0 +virtualenv==21.14.13 # via # -r requirements/release.in # pre-commit + +# The following packages are considered to be unsafe in a requirements file: +pip==26.2.2 + # via -r requirements/release.in diff --git a/tools/__init__.py b/tools/__init__.py index 4a820ca8f..81c3b1068 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -3,7 +3,6 @@ import ptscripts ptscripts.register_tools_module("tools.pre_commit") -ptscripts.register_tools_module("tools.release") -for name in ("boto3", "botocore", "urllib3"): +for name in ("urllib3",): logging.getLogger(name).setLevel(logging.INFO) diff --git a/tools/release.py b/tools/release.py deleted file mode 100644 index 3c7511a99..000000000 --- a/tools/release.py +++ /dev/null @@ -1,148 +0,0 @@ -""" -These commands are used to release Salt Bootstrap. -""" - -# pylint: disable=resource-leakage,broad-except,3rd-party-module-not-gated -from __future__ import annotations - -import logging -import os -import pathlib -import sys -from typing import TYPE_CHECKING - -from ptscripts import command_group -from ptscripts import Context - -import tools.utils - -try: - import boto3 -except ImportError: - print( - "\nPlease run 'python -m pip install -r requirements/release.txt'\n", - file=sys.stderr, - flush=True, - ) - raise - -log = logging.getLogger(__name__) - -# Define the command group -release = command_group( - name="release", - help="Release Related Commands", - description=__doc__, -) - - -@release.command( - name="s3-publish", - arguments={ - "branch": { - "help": "The kind of publish to do.", - "choices": ("stable", "develop"), - }, - "key_id": { - "help": "The GnuPG key ID used to sign.", - "required": True, - }, - }, -) -def s3_publish(ctx: Context, branch: str, key_id: str = None): - """ - Publish scripts to S3. - """ - if TYPE_CHECKING: - assert key_id - - ctx.info("Preparing upload ...") - s3 = boto3.client("s3") - - ctx.info( - f"Uploading release artifacts to {tools.utils.RELEASE_BUCKET_NAME!r} bucket ..." - ) - upload_files = { - "stable": { - f"{tools.utils.GPG_KEY_FILENAME}.gpg": [ - f"bootstrap/stable/{tools.utils.GPG_KEY_FILENAME}.gpg", - ], - f"{tools.utils.GPG_KEY_FILENAME}.pub": [ - f"bootstrap/stable/{tools.utils.GPG_KEY_FILENAME}.pub", - ], - "bootstrap-salt.sh": [ - "bootstrap/stable/bootstrap-salt.sh", - ], - "bootstrap-salt.sh.sha256": [ - "bootstrap/stable/bootstrap-salt.sh.sha256", - "bootstrap/stable/bootstrap/sha256", - ], - "bootstrap-salt.ps1": [ - "bootstrap/stable/bootstrap-salt.ps1", - ], - "bootstrap-salt.ps1.sha256": [ - "bootstrap/stable/bootstrap-salt.ps1.sha256", - "bootstrap/stable/winbootstrap/sha256", - ], - }, - "develop": { - f"{tools.utils.GPG_KEY_FILENAME}.gpg": [ - f"bootstrap/develop/{tools.utils.GPG_KEY_FILENAME}.gpg", - ], - f"{tools.utils.GPG_KEY_FILENAME}.pub": [ - f"bootstrap/develop/{tools.utils.GPG_KEY_FILENAME}.pub", - ], - "bootstrap-salt.sh": [ - "bootstrap/develop/bootstrap-salt.sh", - "bootstrap/develop/bootstrap/develop", - ], - "bootstrap-salt.sh.sha256": [ - "bootstrap/develop/bootstrap-salt.sh.sha256", - ], - "bootstrap-salt.ps1": [ - "bootstrap/develop/bootstrap-salt.ps1", - "bootstrap/develop/winbootstrap/develop", - ], - "bootstrap-salt.ps1.sha256": [ - "bootstrap/develop/bootstrap-salt.ps1.sha256", - ], - }, - } - - files_to_upload: list[tuple[str, str]] = [] - - try: - # Export the GPG key in use - tools.utils.export_gpg_key(ctx, key_id, tools.utils.REPO_ROOT) - for lpath, rpaths in upload_files[branch].items(): - ctx.info(f"Processing {lpath} ...") - if lpath.endswith(".sha256") and not os.path.exists(lpath): - ret = ctx.run( - "sha256sum", - lpath.replace(".sha256", ""), - capture=True, - check=False, - ) - if ret.returncode: - ctx.error(f"Failed to get the sha256sum of {lpath}") - ctx.exit(1) - pathlib.Path(lpath).write_bytes(ret.stdout) - for rpath in rpaths: - files_to_upload.append((lpath, rpath)) - if not lpath.endswith((".gpg", ".pub")): - tools.utils.gpg_sign(ctx, key_id, pathlib.Path(lpath)) - files_to_upload.append((f"{lpath}.asc", f"{rpaths[0]}.asc")) - - for lpath, rpath in sorted(files_to_upload): - size = pathlib.Path(lpath).stat().st_size - ctx.info(f" Uploading {lpath} -> {rpath}") - with tools.utils.create_progress_bar(file_progress=True) as progress: - task = progress.add_task(description="Uploading...", total=size) - s3.upload_file( - lpath, - tools.utils.RELEASE_BUCKET_NAME, - rpath, - Callback=tools.utils.UpdateProgress(progress, task), - ) - except KeyboardInterrupt: - pass diff --git a/tools/utils.py b/tools/utils.py deleted file mode 100644 index b07beb9bc..000000000 --- a/tools/utils.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=resource-leakage,broad-except,3rd-party-module-not-gated -from __future__ import annotations - -import os -import pathlib - -from ptscripts import Context -from rich.progress import BarColumn -from rich.progress import Column -from rich.progress import DownloadColumn -from rich.progress import Progress -from rich.progress import TextColumn -from rich.progress import TimeRemainingColumn -from rich.progress import TransferSpeedColumn - -REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent -GPG_KEY_FILENAME = "SALT-PROJECT-GPG-PUBKEY-2023" -SPB_ENVIRONMENT = os.environ.get("SPB_ENVIRONMENT") or "prod" -RELEASE_BUCKET_NAME = f"salt-project-{SPB_ENVIRONMENT}-salt-artifacts-release" - - -class UpdateProgress: - def __init__(self, progress, task): - self.progress = progress - self.task = task - - def __call__(self, chunk_size): - self.progress.update(self.task, advance=chunk_size) - - -def create_progress_bar(file_progress: bool = False, **kwargs): - if file_progress: - return Progress( - TextColumn("[progress.description]{task.description}"), - BarColumn(), - DownloadColumn(), - TransferSpeedColumn(), - TextColumn("eta"), - TimeRemainingColumn(), - **kwargs, - ) - return Progress( - TextColumn( - "[progress.description]{task.description}", table_column=Column(ratio=3) - ), - BarColumn(), - expand=True, - **kwargs, - ) - - -def export_gpg_key(ctx: Context, key_id: str, export_path: pathlib.Path): - keyfile_gpg = export_path.joinpath(GPG_KEY_FILENAME).with_suffix(".gpg") - if keyfile_gpg.exists(): - keyfile_gpg.unlink() - ctx.info(f"Exporting GnuPG Key '{key_id}' to {keyfile_gpg} ...") - ctx.run("gpg", "--output", str(keyfile_gpg), "--export", key_id) - keyfile_pub = export_path.joinpath(GPG_KEY_FILENAME).with_suffix(".pub") - if keyfile_pub.exists(): - keyfile_pub.unlink() - ctx.info(f"Exporting GnuPG Key '{key_id}' to {keyfile_pub} ...") - ctx.run("gpg", "--armor", "--output", str(keyfile_pub), "--export", key_id) - - -def gpg_sign(ctx: Context, key_id: str, path: pathlib.Path): - ctx.info(f"GPG Signing '{path}' ...") - signature_fpath = path.parent / f"{path.name}.asc" - if signature_fpath.exists(): - signature_fpath.unlink() - ctx.run( - "gpg", - "--local-user", - key_id, - "--output", - str(signature_fpath), - "--armor", - "--detach-sign", - "--sign", - str(path), - ) From 0d7b0d838a56bc102035ecb2c26be068423c65b2 Mon Sep 17 00:00:00 2001 From: Twangboy Date: Mon, 26 Oct 2026 09:54:57 -0600 Subject: [PATCH 2/2] Remove dead nightly S3 workflow It only checked requirements and no longer published anything. --- .github/workflows/nightly.yml | 43 ----------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index c776a44cc..000000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Nightly S3 Update -run-name: "Nightly S3 (branch: ${{ github.ref_name }})" - -on: - workflow_dispatch: {} - schedule: - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule - - cron: '0 1 * * *' # Every day at 1AM - -jobs: - - workflow-requirements: - name: Check Workflow Requirements - runs-on: ubuntu-latest - outputs: - requirements-met: ${{ steps.check-requirements.outputs.requirements-met }} - steps: - - name: Check For Admin Permission - if: ${{ github.event_name != 'schedule' }} - uses: actions-cool/check-user-permission@v2 - with: - require: admin - username: ${{ github.triggering_actor }} - - - name: Check Requirements - id: check-requirements - run: | - if [ "${{ vars.RUN_SCHEDULED_BUILDS }}" = "1" ]; then - MSG="Running workflow because RUN_SCHEDULED_BUILDS=1" - echo "${MSG}" - echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" - echo "requirements-met=true" >> "${GITHUB_OUTPUT}" - elif [ "${{ github.event.repository.fork }}" = "true" ]; then - MSG="Not running workflow because ${{ github.repository }} is a fork" - echo "${MSG}" - echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" - echo "requirements-met=false" >> "${GITHUB_OUTPUT}" - else - MSG="Running workflow because ${{ github.repository }} is not a fork" - echo "${MSG}" - echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" - echo "requirements-met=true" >> "${GITHUB_OUTPUT}" - fi