Skip to content

Commit

Permalink
Allow test/ldd-check to resolve shared objects in the same python mod…
Browse files Browse the repository at this point in the history
…ule, run newly passing tests (#41625)

Fixes: #41002,
#40838,
#41304,
#41305

These are cases where a python module brings a shared object with it,
and then that shared object links against a 2nd shared object brought by
the same module.
In this case SO1 links against SO2 using just the library name (instead
of a relative path), which the python interpreter allows by loading
objects in the same directory before looking elsewhere. LDD doesn't do
this by default.

Related: #40831,
#40843,
#40842

These have cases of this but they also have some other ldd failures
unrelated to python stuff.

---------

Signed-off-by: Amelia Crate <amelia.crate@chainguard.dev>
  • Loading branch information
a-crate authored Feb 10, 2025
1 parent 15eb5d8 commit a71f122
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
6 changes: 6 additions & 0 deletions checkov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ pipeline:
- uses: strip

test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{package.name}}

update:
enabled: false
9 changes: 9 additions & 0 deletions kserve.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ subpackages:
- name: "test entrypoint usage"
runs: |
/storage-initializer/scripts/initializer-entrypoint --help
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{package.name}}

update:
enabled: true
Expand Down
51 changes: 51 additions & 0 deletions kubeflow-katib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-earlystopping/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-tfevent-metricscollector
description: Kubeflow Katib tfevent-metricscollector
Expand All @@ -105,6 +110,11 @@ subpackages:
cp -r ./pkg ${{targets.subpkgdir}}/opt/katib/pkg
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
cd ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-hyperband
description: Kubeflow Katib suggestion-hyperband
Expand All @@ -124,6 +134,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-hyperband/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-hyperopt
description: Kubeflow Katib suggestion-hyperopt
Expand All @@ -142,6 +157,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-hyperopt/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-nas-darts
description: Kubeflow Katib suggestion-nas-darts
Expand All @@ -160,6 +180,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-darts/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-nas-enas
description: Kubeflow Katib suggestion-nas-enas
Expand All @@ -179,6 +204,11 @@ subpackages:
cp -r ./pkg ${{targets.subpkgdir}}/opt/katib/pkg
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
cd ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-optuna-enas
description: Kubeflow Katib suggestion-optuna-enas
Expand All @@ -197,6 +227,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-optuna/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-pbt-enas
description: Kubeflow Katib suggestion-pbt-enas
Expand All @@ -215,6 +250,11 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-pbt/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

- name: katib-suggestion-skopt-enas
description: Kubeflow Katib suggestion-skopt-enas
Expand All @@ -234,6 +274,17 @@ subpackages:
tar c ./pkg | tar xvf - -C ${{targets.subpkgdir}}/opt/katib/
mv .venv-skopt/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
mv ./$SUGGESTION_DIR/* ${{targets.subpkgdir}}/opt/katib/$SUGGESTION_DIR
test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

test:
pipeline:
- uses: test/ldd-check
with:
packages: ${{package.name}}

update:
enabled: true
Expand Down
6 changes: 6 additions & 0 deletions mlflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ subpackages:
ls /bitnami/mlflow-basic-auth/ | grep "basic_auth.ini"
run-script --version
run-script --help
- uses: test/ldd-check
with:
packages: ${{subpkg.name}}

test:
environment:
Expand All @@ -139,6 +142,9 @@ test:
export PATH="/usr/share/mlflow/bin:${PATH}"
python3 ./test-mlflow.py
mlflow ui & sleep 5; curl -vsL localhost:5000
- uses: test/ldd-check
with:
packages: ${{package.name}}

update:
enabled: true
Expand Down
11 changes: 10 additions & 1 deletion pipelines/test/ldd-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pipeline:
check_file() {
local f="$1" insist_dyn="$2" rc="0"
local outf="$tmpd/ldd.stdout" errf="$tmpd/ldd.sterr"
local ld_library_path=$LD_LIBRARY_PATH
if [ ! -e "$f" ]; then
failormsg "$insist_dyn" "$f: did not exist"
return 0
Expand All @@ -88,7 +90,14 @@ pipeline:
return 0
fi
ldd "$f" >$outf 2>$errf || rc=$?
case "$f" in
*python*site-packages*)
[ -n "$ld_library_path" ] && ld_library_path=$ld_library_path:
ld_library_path=$(dirname "$f")
vmsg "Added python site package directory to ld_library_path, result is $ld_library_path"
esac
LD_LIBRARY_PATH=$ld_library_path ldd "$f" >$outf 2>$errf || rc=$?
if [ $rc -eq 1 ]; then
if grep -q 'not a dynamic executable' "$errf"; then
Expand Down

0 comments on commit a71f122

Please sign in to comment.