Skip to content

Commit d8bfbcd

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 5b3f65f + 0de0440 commit d8bfbcd

File tree

3 files changed

+410
-2
lines changed

3 files changed

+410
-2
lines changed

ci/cached-builds/gha_pr_changed_files.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ def get_github_token() -> str:
2222
def list_changed_files(from_ref: str, to_ref: str) -> list[str]:
2323
logging.debug("Getting list of changed files from git diff")
2424

25+
# Use three-dot diff to show changes from merge-base to to_ref
26+
# This correctly shows only changes introduced by the PR, regardless of how much from_ref has advanced
27+
# See: https://github.com/opendatahub-io/notebooks/issues/2875
2528
# https://github.com/red-hat-data-services/notebooks/pull/361: add -- in case to_ref matches a file name in the repo
2629
files = subprocess.check_output(
27-
["git", "diff", "--name-only", from_ref, to_ref, "--"], encoding="utf-8"
30+
["git", "diff", "--name-only", f"{from_ref}...{to_ref}", "--"], encoding="utf-8"
2831
).splitlines()
2932

3033
logging.debug(f"Determined {len(files)} changed files: {files[:100]} (..., printing up to 100 files)")
@@ -157,7 +160,7 @@ def test_list_changed_files(self):
157160

158161
def test_get_build_directory(self):
159162
directory = get_build_directory("rocm-jupyter-pytorch-ubi9-python-3.12")
160-
assert directory == "jupyter/rocm/pytorch/ubi9-python-3.11"
163+
assert directory == "jupyter/rocm/pytorch/ubi9-python-3.12"
161164

162165
def test_get_build_dockerfile(self):
163166
dockerfile = get_build_dockerfile("rocm-jupyter-pytorch-ubi9-python-3.12")

scripts/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,57 @@ Updates Dockerfile* blocks demarked using comment blocks of the form
6666

6767
Run the script to to automatically update the block's content to be the same in all Dockerfiles everywhere.
6868

69+
## sbom_analyze.py
70+
71+
Analyze syft SBOM JSON files for CVE investigation. This script helps developers find where vulnerable packages are installed within container images by querying SBOM files from the manifest-box repository.
72+
73+
See [docs/manifestbox.md](../docs/manifestbox.md) for detailed documentation on working with SBOMs.
74+
75+
### Examples
76+
77+
Find a specific package and its installation location:
78+
79+
```sh
80+
python scripts/sbom_analyze.py sbom.json esbuild
81+
```
82+
83+
Output:
84+
```
85+
=== Searching for 'esbuild' ===
86+
Found 1 matching package(s):
87+
88+
esbuild@0.17.14
89+
Type: npm
90+
Found by: javascript-package-cataloger
91+
Locations:
92+
- /usr/lib/code-server/lib/vscode/extensions/php/package.json
93+
PURL: pkg:npm/esbuild@0.17.14
94+
```
95+
96+
Get SBOM metadata (source image, version, distro):
97+
98+
```sh
99+
python scripts/sbom_analyze.py sbom.json --info
100+
```
101+
102+
Summarize packages by ecosystem type:
103+
104+
```sh
105+
python scripts/sbom_analyze.py sbom.json --summary
106+
```
107+
108+
Find all packages at a specific path:
109+
110+
```sh
111+
python scripts/sbom_analyze.py sbom.json --path /code-server/
112+
```
113+
114+
Output as JSON for scripting:
115+
116+
```sh
117+
python scripts/sbom_analyze.py sbom.json esbuild --json
118+
```
119+
69120
## buildinputs/
70121

71122
CLI tool written in Go that computes the list of input files required to build a Dockerfile.

0 commit comments

Comments
 (0)