Skip to content

Commit 4802ee3

Browse files
authored
Merge pull request #68474 from dwoz/merge/3007.x/master-25-11-19
Merge forward 3007.x into master
2 parents 904d08b + 1f316b7 commit 4802ee3

File tree

264 files changed

+6061
-3295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+6061
-3295
lines changed

.github/actions/build-onedir-deps/action.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,25 @@ runs:
2525
using: composite
2626

2727
steps:
28+
- name: Get Hash For Onedir Deps Cache
29+
id: onedir-deps-hash
30+
shell: bash
31+
run: |
32+
HASH=$(python3 .github/scripts/hash-files.py \
33+
'.relenv/**/*.xz' \
34+
'requirements/static/pkg/*/*.txt' \
35+
'tools/pkg/build.py' \
36+
'.github/actions/build-onedir-deps/action.yml' \
37+
'.github/workflows/build-deps-onedir-*.yml' \
38+
'cicd/shared-gh-workflows-context.yml')
39+
echo "hash=${HASH}" | tee -a "$GITHUB_OUTPUT"
40+
2841
- name: Cache Deps Onedir Package Directory
2942
id: onedir-pkg-cache
3043
uses: ./.github/actions/cache
3144
with:
3245
path: artifacts/${{ inputs.package-name }}
33-
key: >
34-
${{ inputs.cache-prefix }}|${{ inputs.python-version }}|deps|${{ inputs.platform }}|${{ inputs.arch }}|${{ inputs.package-name }}|${{
35-
hashFiles(
36-
format('{0}/.relenv/**/*.xz', github.workspace),
37-
'requirements/static/pkg/*/*.txt',
38-
'tools/pkg/build.py',
39-
'.github/actions/build-onedir-deps/action.yml',
40-
'.github/workflows/build-deps-onedir-*.yml',
41-
'cicd/shared-gh-workflows-context.yml'
42-
)
43-
}}
46+
key: ${{ inputs.cache-prefix }}|${{ inputs.python-version }}|deps|${{ inputs.platform }}|${{ inputs.arch }}|${{ inputs.package-name }}|${{ steps.onedir-deps-hash.outputs.hash }}
4447

4548
- name: Install Salt Onedir Package Dependencies
4649
shell: bash

.github/actions/setup-python-tools-scripts/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ runs:
3131
id: venv-hash
3232
shell: bash
3333
run: |
34+
FILES_HASH=$(python3 .github/scripts/hash-files.py 'requirements/**/*.txt' 'tools/**/*.py')
3435
VENV_NAME_HASH=$(echo "${{ inputs.cache-prefix }}|${{ github.workflow }}|${{
35-
steps.get-python-version.outputs.version-sha256sum }}|${{
36-
hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}" | sha256sum | cut -d ' ' -f 1)
36+
steps.get-python-version.outputs.version-sha256sum }}|${FILES_HASH}" | sha256sum | cut -d ' ' -f 1)
3737
echo "TOOLS_VIRTUALENV_CACHE_SEED=$VENV_NAME_HASH" | tee -a "${GITHUB_ENV}"
3838
echo "venv-hash=$VENV_NAME_HASH" | tee -a "${GITHUB_OUTPUT}"
3939

.github/scripts/hash-files.py

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Cross-platform replacement for GitHub Actions hashFiles() function.
4+
5+
This script computes a hash of files matching the given glob patterns,
6+
compatible with Linux, macOS, and Windows runners.
7+
8+
Usage:
9+
python hash-files.py 'pattern1' 'pattern2' ...
10+
11+
Example:
12+
python hash-files.py 'requirements/**/*.txt' 'noxfile.py'
13+
"""
14+
import hashlib
15+
import sys
16+
from pathlib import Path
17+
18+
19+
def find_files(patterns):
20+
"""
21+
Find all files matching the given glob patterns.
22+
23+
Args:
24+
patterns: List of glob patterns (e.g., 'requirements/**/*.txt')
25+
26+
Returns:
27+
Sorted list of Path objects for matching files
28+
"""
29+
files = set()
30+
repo_root = Path.cwd()
31+
32+
for pattern in patterns:
33+
# Handle both absolute and relative patterns
34+
pattern = pattern.strip()
35+
if not pattern:
36+
continue
37+
38+
# Check if pattern is absolute
39+
pattern_path = Path(pattern)
40+
if pattern_path.is_absolute():
41+
# For absolute paths, extract the pattern relative to repo root
42+
# e.g., /home/runner/work/salt/salt/.relenv/**/*.xz -> .relenv/**/*.xz
43+
try:
44+
# Try to make it relative to repo root
45+
relative_pattern = pattern_path.relative_to(repo_root)
46+
pattern = str(relative_pattern)
47+
except ValueError:
48+
# Pattern is outside repo root, use as-is
49+
# Try to glob from root
50+
if "**" in pattern or "*" in pattern or "?" in pattern:
51+
# It's a glob pattern with absolute base
52+
# Extract the base directory and the glob part
53+
parts = pattern.split("/")
54+
# Find the first part with a glob character
55+
for i, part in enumerate(parts):
56+
if "*" in part or "?" in part:
57+
base = Path("/".join(parts[:i]))
58+
glob_pattern = "/".join(parts[i:])
59+
matching_paths = base.glob(glob_pattern)
60+
for path in matching_paths:
61+
if path.is_file():
62+
files.add(path)
63+
break
64+
continue
65+
else:
66+
# It's an absolute path to a single file
67+
if pattern_path.is_file():
68+
files.add(pattern_path)
69+
continue
70+
71+
# Use glob for patterns
72+
matching_paths = repo_root.glob(pattern)
73+
74+
# Add only files (not directories)
75+
for path in matching_paths:
76+
if path.is_file():
77+
files.add(path)
78+
79+
# Sort for consistent ordering across platforms
80+
return sorted(files)
81+
82+
83+
def hash_files(file_paths):
84+
"""
85+
Compute SHA256 hash of the contents of all files.
86+
87+
Args:
88+
file_paths: List of Path objects to hash
89+
90+
Returns:
91+
Hexadecimal hash string
92+
"""
93+
hasher = hashlib.sha256()
94+
95+
for file_path in file_paths:
96+
try:
97+
# Add the relative path to the hash for consistency
98+
# Try to make it relative to cwd, otherwise use the full path
99+
try:
100+
rel_path = file_path.relative_to(Path.cwd())
101+
except ValueError:
102+
# File is outside cwd, use absolute path
103+
rel_path = file_path
104+
hasher.update(str(rel_path).encode("utf-8"))
105+
106+
# Read and hash file contents in binary mode
107+
with open(file_path, "rb") as f:
108+
# Read in chunks to handle large files efficiently
109+
while chunk := f.read(8192):
110+
hasher.update(chunk)
111+
except (OSError, IOError) as e:
112+
# Print warning but continue with other files
113+
print(f"Warning: Could not read {file_path}: {e}", file=sys.stderr)
114+
continue
115+
116+
return hasher.hexdigest()
117+
118+
119+
def main():
120+
"""Main entry point."""
121+
if len(sys.argv) < 2:
122+
print("Usage: python hash-files.py 'pattern1' 'pattern2' ...", file=sys.stderr)
123+
print("", file=sys.stderr)
124+
print(
125+
"Example: python hash-files.py 'requirements/**/*.txt' 'noxfile.py'",
126+
file=sys.stderr,
127+
)
128+
sys.exit(1)
129+
130+
patterns = sys.argv[1:]
131+
132+
# Find all matching files
133+
files = find_files(patterns)
134+
135+
if not files:
136+
# Return empty hash if no files found (mimics hashFiles behavior)
137+
print("")
138+
return
139+
140+
# Compute and print hash
141+
file_hash = hash_files(files)
142+
print(file_hash)
143+
144+
145+
if __name__ == "__main__":
146+
main()

.github/workflows/build-deps-ci-action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157

158158
macos-dependencies:
159159
name: MacOS
160-
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }}
160+
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-15-intel' || 'macos-14' }}
161161
if: ${{ toJSON(fromJSON(inputs.matrix)['macos']) != '[]' }}
162162
timeout-minutes: 90
163163
strategy:

.github/workflows/build-docs.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,19 @@ jobs:
6868
run: |
6969
tools pkg apply-release-patch salt-${{ inputs.salt-version }}.patch --delete
7070
71+
- name: Get Hash For Docs Requirements
72+
id: docs-requirements-hash
73+
shell: bash
74+
run: |
75+
HASH=$(python3 .github/scripts/hash-files.py 'requirements/**/docs.txt')
76+
echo "hash=${HASH}" | tee -a "$GITHUB_OUTPUT"
77+
7178
- name: Cache Python Tools Docs Virtualenv
7279
id: tools-venvs-dependencies-cache
7380
uses: ./.github/actions/cache
7481
with:
7582
path: .tools-venvs/docs
76-
key: ${{ inputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
83+
key: ${{ inputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ steps.docs-requirements-hash.outputs.hash }}
7784

7885
- name: Prepare Docs Build
7986
run: |

.github/workflows/build-packages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
run: |
114114
mkdir -p ~/.local/relenv
115115
python3 -m venv venv
116-
venv/bin/python3 -m pip install relenv ppbt
116+
venv/bin/python3 -m pip install ppbt relenv==${{ inputs.relenv-version }}
117117
venv/bin/python3 -c 'from relenv import common; common.get_toolchain()'
118118
119119
- name: Download Release Patch
@@ -208,7 +208,7 @@ jobs:
208208
run: |
209209
mkdir -p ~/.local/relenv
210210
python3 -m venv venv
211-
venv/bin/python3 -m pip install relenv ppbt
211+
venv/bin/python3 -m pip install ppbt relenv==${{ inputs.relenv-version }}
212212
venv/bin/python3 -c 'from relenv import common; common.get_toolchain()'
213213
214214
- name: Download Release Patch
@@ -294,7 +294,7 @@ jobs:
294294
env:
295295
PIP_INDEX_URL: https://pypi.org/simple
296296
runs-on:
297-
- ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
297+
- ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-15-intel' }}
298298

299299
steps:
300300
- name: Check Package Signing Enabled
@@ -503,7 +503,7 @@ jobs:
503503
504504
- name: Code signing with Software Trust Manager
505505
if: ${{ steps.check-pkg-sign.outputs.sign-pkgs == 'true' }}
506-
uses: digicert/ssm-code-signing@v0.0.2
506+
uses: digicert/ssm-code-signing@v1.1.1
507507

508508
- name: Build Windows Packages
509509
run: |

.github/workflows/build-salt-onedir.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
matrix:
110110
include: ${{ fromJSON(inputs.matrix)['macos'] }}
111111
runs-on:
112-
- ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
112+
- ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-15-intel' }}
113113
env:
114114
PIP_INDEX_URL: https://pypi.org/simple
115115
USE_S3_CACHE: 'false'

.github/workflows/ci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,15 @@ jobs:
172172

173173
- name: Get Hash For Nox Tarball Cache
174174
id: nox-archive-hash
175+
shell: bash
175176
run: |
176-
echo "nox-archive-hash=${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json', 'noxfile.py', 'pkg/common/env-cleanup-rules.yml', '.github/workflows/build-deps-ci-action.yml') }}" | tee -a "$GITHUB_OUTPUT"
177+
HASH=$(python3 .github/scripts/hash-files.py \
178+
'requirements/**/*.txt' \
179+
'cicd/golden-images.json' \
180+
'noxfile.py' \
181+
'pkg/common/env-cleanup-rules.yml' \
182+
'.github/workflows/build-deps-ci-action.yml')
183+
echo "nox-archive-hash=${HASH}" | tee -a "$GITHUB_OUTPUT"
177184
178185
- name: Write Changed Files To A Local File
179186
run:
@@ -439,7 +446,7 @@ jobs:
439446
with:
440447
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
441448
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
442-
relenv-version: "0.21.1"
449+
relenv-version: "0.21.2"
443450
python-version: "3.11.14"
444451
ci-python-version: "3.11"
445452
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
@@ -456,7 +463,7 @@ jobs:
456463
with:
457464
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
458465
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
459-
relenv-version: "0.21.1"
466+
relenv-version: "0.21.2"
460467
python-version: "3.11.14"
461468
ci-python-version: "3.11"
462469
source: "onedir"
@@ -473,7 +480,7 @@ jobs:
473480
with:
474481
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
475482
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
476-
relenv-version: "0.21.1"
483+
relenv-version: "0.21.2"
477484
python-version: "3.11.14"
478485
ci-python-version: "3.11"
479486
source: "src"

.github/workflows/depcheck.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,15 @@ jobs:
169169

170170
- name: Get Hash For Nox Tarball Cache
171171
id: nox-archive-hash
172+
shell: bash
172173
run: |
173-
echo "nox-archive-hash=${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json', 'noxfile.py', 'pkg/common/env-cleanup-rules.yml', '.github/workflows/build-deps-ci-action.yml') }}" | tee -a "$GITHUB_OUTPUT"
174+
HASH=$(python3 .github/scripts/hash-files.py \
175+
'requirements/**/*.txt' \
176+
'cicd/golden-images.json' \
177+
'noxfile.py' \
178+
'pkg/common/env-cleanup-rules.yml' \
179+
'.github/workflows/build-deps-ci-action.yml')
180+
echo "nox-archive-hash=${HASH}" | tee -a "$GITHUB_OUTPUT"
174181
175182
- name: Write Changed Files To A Local File
176183
run:

.github/workflows/draft-release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ env:
2626

2727
jobs:
2828

29-
list-artifacts:
30-
name: List Artifacts
31-
runs-on: ubuntu-22.04
32-
steps:
33-
# Checkout here so we can easily use custom actions
34-
- uses: actions/download-artifact@v4
35-
with:
36-
path: artifacts/
37-
- name: List Directory Structure
38-
run: ls -R artifacts/
29+
#list-artifacts:
30+
# name: List Artifacts
31+
# runs-on: ubuntu-22.04
32+
# steps:
33+
# # Checkout here so we can easily use custom actions
34+
# - uses: actions/download-artifact@v4
35+
# with:
36+
# path: artifacts/
37+
# - name: List Directory Structure
38+
# run: ls -R artifacts/
3939

4040
create-github-release:
4141
name: Draft Release v${{ inputs.salt-version }}

0 commit comments

Comments
 (0)