Skip to content

Commit

Permalink
ci(update-vulnerable-dependencies): pass KUMA_DIR to the script (back…
Browse files Browse the repository at this point in the history
…port of #9795) (#9797)

ci(update-vulnerable-dependencies): pass KUMA_DIR to the script (#9795)

When this target is being called from the projects which depends
on Kuma, path to `tools/ci/update-vulnerable-dependencies/main.go`
is different, so script needs to take into account this root path.

Signed-off-by: Bart Smykla <[email protected]>
Co-authored-by: Bart Smykla <[email protected]>
  • Loading branch information
kumahq[bot] and bartsmykla authored Apr 3, 2024
1 parent 05f6149 commit 997089f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ set -e
command -v osv-scanner >/dev/null 2>&1 || { echo >&2 "osv-scanner not installed!"; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "jq not installed!"; exit 1; }

SCRIPT_PATH="${BASH_SOURCE[0]:-$0}";
SCRIPT_DIR="$(dirname -- "$SCRIPT_PATH")"

for dep in $(osv-scanner --lockfile=go.mod --json | jq -c '.results[].packages[] | .package.name as $vulnerablePackage | {
name: $vulnerablePackage,
current: .package.version,
fixedVersions: [.vulnerabilities[].affected[] | select(.package.name == $vulnerablePackage) | .ranges[].events |
map(select(.fixed != null) | .fixed)] | map(select(length > 0)) } | select(.name != "github.com/kumahq/kuma")'); do

fixVersion=$(go run tools/ci/update-vulnerable-dependencies/main.go <<< "$dep")
fixVersion=$(go run "$SCRIPT_DIR"/main.go <<< "$dep")

if [ "$fixVersion" != "null" ]; then
package=$(jq -r .name <<< "$dep")
Expand Down

0 comments on commit 997089f

Please sign in to comment.