From fcf89152d91497e72542f615ab7bd3100981d037 Mon Sep 17 00:00:00 2001 From: iamazzeez Date: Thu, 12 Sep 2024 12:14:54 +0530 Subject: [PATCH] all go upgrade latest fixes Signed-off-by: iamazzeez --- .license_scout.yml | 256 +++++++++++++++++++++++++++++++++++++++++ scripts/repo_health.sh | 39 +++---- 2 files changed, 272 insertions(+), 23 deletions(-) diff --git a/.license_scout.yml b/.license_scout.yml index 234067adb01..16ac1f88dd2 100644 --- a/.license_scout.yml +++ b/.license_scout.yml @@ -1443,3 +1443,259 @@ exceptions: reason: Exception made by Chef Legal - name: yallist reason: Exception made by Chef Legal + + golang: + - name: cloud.google.com/go/accessapproval + reason: Exception made by Chef Legal + - name: cloud.google.com/go/accesscontextmanager + reason: Exception made by Chef Legal + - name: cloud.google.com/go/aiplatform + reason: Exception made by Chef Legal + - name: cloud.google.com/go/analytics + reason: Exception made by Chef Legal + - name: cloud.google.com/go/apigateway + reason: Exception made by Chef Legal + - name: cloud.google.com/go/apigeeconnect + reason: Exception made by Chef Legal + - name: cloud.google.com/go/appengine + reason: Exception made by Chef Legal + - name: cloud.google.com/go/area120 + reason: Exception made by Chef Legal + - name: cloud.google.com/go/artifactregistry + reason: Exception made by Chef Legal + - name: cloud.google.com/go/asset + reason: Exception made by Chef Legal + - name: cloud.google.com/go/assuredworkloads + reason: Exception made by Chef Legal + - name: cloud.google.com/go/automl + reason: Exception made by Chef Legal + - name: cloud.google.com/go/baremetalsolution + reason: Exception made by Chef Legal + - name: cloud.google.com/go/batch + reason: Exception made by Chef Legal + - name: cloud.google.com/go/beyondcorp + reason: Exception made by Chef Legal + - name: cloud.google.com/go/billing + reason: Exception made by Chef Legal + - name: cloud.google.com/go/binaryauthorization + reason: Exception made by Chef Legal + - name: cloud.google.com/go/certificatemanager + reason: Exception made by Chef Legal + - name: cloud.google.com/go/channel + reason: Exception made by Chef Legal + - name: cloud.google.com/go/cloudbuild + reason: Exception made by Chef Legal + - name: cloud.google.com/go/clouddms + reason: Exception made by Chef Legal + - name: cloud.google.com/go/cloudtasks + reason: Exception made by Chef Legal + - name: cloud.google.com/go/contactcenterinsights + reason: Exception made by Chef Legal + - name: cloud.google.com/go/recaptchaenterprise/v2 + reason: Exception made by Chef Legal + - name: cloud.google.com/go/vision/v2 + reason: Exception made by Chef Legal + - name: cloud.google.com/go/workflows + reason: Exception made by Chef Legal + - name: cloud.google.com/go/container + reason: Exception made by Chef Legal + - name: cloud.google.com/go/containeranalysis + reason: Exception made by Chef Legal + - name: cloud.google.com/go/datacatalog + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dataflow + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dataform + reason: Exception made by Chef Legal + - name: cloud.google.com/go/datafusion + reason: Exception made by Chef Legal + - name: cloud.google.com/go/datalabeling + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dataplex + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dataproc + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dataqna + reason: Exception made by Chef Legal + - name: cloud.google.com/go/datastream + reason: Exception made by Chef Legal + - name: cloud.google.com/go/deploy + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dialogflow + reason: Exception made by Chef Legal + - name: cloud.google.com/go/dlp + reason: Exception made by Chef Legal + - name: cloud.google.com/go/documentai + reason: Exception made by Chef Legal + - name: cloud.google.com/go/domains + reason: Exception made by Chef Legal + - name: cloud.google.com/go/edgecontainer + reason: Exception made by Chef Legal + - name: cloud.google.com/go/essentialcontacts + reason: Exception made by Chef Legal + - name: cloud.google.com/go/eventarc + reason: Exception made by Chef Legal + - name: cloud.google.com/go/filestore + reason: Exception made by Chef Legal + - name: cloud.google.com/go/functions + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gaming + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gkebackup + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gkeconnect + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gkehub + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gkemulticloud + reason: Exception made by Chef Legal + - name: cloud.google.com/go/gsuiteaddons + reason: Exception made by Chef Legal + - name: cloud.google.com/go/iap + reason: Exception made by Chef Legal + - name: cloud.google.com/go/ids + reason: Exception made by Chef Legal + - name: cloud.google.com/go/iot + reason: Exception made by Chef Legal + - name: cloud.google.com/go/kms + reason: Exception made by Chef Legal + - name: cloud.google.com/go/language + reason: Exception made by Chef Legal + - name: cloud.google.com/go/lifesciences + reason: Exception made by Chef Legal + - name: cloud.google.com/go/managedidentities + reason: Exception made by Chef Legal + - name: cloud.google.com/go/mediatranslation + reason: Exception made by Chef Legal + - name: cloud.google.com/go/memcache + reason: Exception made by Chef Legal + - name: cloud.google.com/go/metastore + reason: Exception made by Chef Legal + - name: cloud.google.com/go/monitoring + reason: Exception made by Chef Legal + - name: cloud.google.com/go/networkconnectivity + reason: Exception made by Chef Legal + - name: cloud.google.com/go/networkmanagement + reason: Exception made by Chef Legal + - name: cloud.google.com/go/networksecurity + reason: Exception made by Chef Legal + - name: cloud.google.com/go/notebooks + reason: Exception made by Chef Legal + - name: cloud.google.com/go/optimization + reason: Exception made by Chef Legal + - name: cloud.google.com/go/orchestration + reason: Exception made by Chef Legal + - name: cloud.google.com/go/orgpolicy + reason: Exception made by Chef Legal + - name: cloud.google.com/go/osconfig + reason: Exception made by Chef Legal + - name: cloud.google.com/go/oslogin + reason: Exception made by Chef Legal + - name: cloud.google.com/go/phishingprotection + reason: Exception made by Chef Legal + - name: cloud.google.com/go/policytroubleshooter + reason: Exception made by Chef Legal + - name: cloud.google.com/go/privatecatalog + reason: Exception made by Chef Legal + - name: cloud.google.com/go/recaptchaenterprise + reason: Exception made by Chef Legal + - name: cloud.google.com/go/recommendationengine + reason: Exception made by Chef Legal + - name: cloud.google.com/go/recommender + reason: Exception made by Chef Legal + - name: cloud.google.com/go/redis + reason: Exception made by Chef Legal + - name: cloud.google.com/go/resourcemanager + reason: Exception made by Chef Legal + - name: cloud.google.com/go/resourcesettings + reason: Exception made by Chef Legal + - name: cloud.google.com/go/retail + reason: Exception made by Chef Legal + - name: cloud.google.com/go/run + reason: Exception made by Chef Legal + - name: cloud.google.com/go/scheduler + reason: Exception made by Chef Legal + - name: cloud.google.com/go/secretmanager + reason: Exception made by Chef Legal + - name: cloud.google.com/go/security + reason: Exception made by Chef Legal + - name: cloud.google.com/go/securitycenter + reason: Exception made by Chef Legal + - name: cloud.google.com/go/servicecontrol + reason: Exception made by Chef Legal + - name: cloud.google.com/go/servicedirectory + reason: Exception made by Chef Legal + - name: cloud.google.com/go/servicemanagement + reason: Exception made by Chef Legal + - name: cloud.google.com/go/serviceusage + reason: Exception made by Chef Legal + - name: cloud.google.com/go/shell + reason: Exception made by Chef Legal + - name: cloud.google.com/go/speech + reason: Exception made by Chef Legal + - name: cloud.google.com/go/storagetransfer + reason: Exception made by Chef Legal + - name: cloud.google.com/go/talent + reason: Exception made by Chef Legal + - name: cloud.google.com/go/texttospeech + reason: Exception made by Chef Legal + - name: cloud.google.com/go/tpu + reason: Exception made by Chef Legal + - name: cloud.google.com/go/trace + reason: Exception made by Chef Legal + - name: cloud.google.com/go/translate + reason: Exception made by Chef Legal + - name: cloud.google.com/go/video + reason: Exception made by Chef Legal + - name: cloud.google.com/go/videointelligence + reason: Exception made by Chef Legal + - name: cloud.google.com/go/vision + reason: Exception made by Chef Legal + - name: cloud.google.com/go/vmmigration + reason: Exception made by Chef Legal + - name: cloud.google.com/go/vpcaccess + reason: Exception made by Chef Legal + - name: cloud.google.com/go/webrisk + reason: Exception made by Chef Legal + - name: cloud.google.com/go/websecurityscanner + reason: Exception made by Chef Legal + - name: github.com/DataDog/zstd + reason: Exception made by Chef Legal + - name: github.com/Sereal/Sereal/Go/sereal + reason: Exception made by Chef Legal + - name: github.com/alecthomas/kingpin/v2 + reason: Exception made by Chef Legal + - name: github.com/apparentlymart/go-textseg/v13 + reason: Exception made by Chef Legal + - name: github.com/cncf/xds/go + reason: Exception made by Chef Legal + - name: github.com/davecgh/go-xdr + reason: Exception made by Chef Legal + - name: github.com/golang/snappy + reason: Exception made by Chef Legal + - name: github.com/google/go-pkcs11 + reason: Exception made by Chef Legal + - name: github.com/montanaflynn/stats + reason: Exception made by Chef Legal + - name: github.com/pquerna/ffjson + reason: Exception made by Chef Legal + - name: github.com/vmihailenco/msgpack/v5 + reason: Exception made by Chef Legal + - name: github.com/vmihailenco/tagparser/v2 + reason: Exception made by Chef Legal + - name: github.com/xdg-go/pbkdf2 + reason: Exception made by Chef Legal + - name: github.com/xdg-go/scram + reason: Exception made by Chef Legal + - name: github.com/xdg-go/stringprep + reason: Exception made by Chef Legal + - name: github.com/xhit/go-str2duration + reason: Exception made by Chef Legal + - name: github.com/youmark/pkcs8 + reason: Exception made by Chef Legal + - name: go.etcd.io/gofail + reason: Exception made by Chef Legal + - name: gopkg.in/mgo.v2 + reason: Exception made by Chef Legal + - name: gopkg.in/vmihailenco/msgpack.v2 + reason: Exception made by Chef Legal diff --git a/scripts/repo_health.sh b/scripts/repo_health.sh index 48b0e46a326..31779f5f5e0 100755 --- a/scripts/repo_health.sh +++ b/scripts/repo_health.sh @@ -29,33 +29,26 @@ yml2json() { ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' "$1" } - echo "Checking if Golang license fallbacks/exceptions are needed" -# Convert the .license_scout.yml file to JSON + +# Convert the YAML to JSON license_scout=$(yml2json .license_scout.yml) -# Define an array of go.sum file locations -sum_files=("go.sum" "protovendor/go.sum" "api/external/go.sum") +# Get the list of Golang packages marked as exceptions +exceptions=$(jq -ner --argjson data "$license_scout" '$data | (.exceptions.golang // [])[].name') -# Loop through each Golang dependency in the license_scout file -for d in $(jq -ner --argjson data "$license_scout" '$data | (.fallbacks, .exceptions) | (.golang // [])[].name'); do - found=false - # Check each go.sum file - for sum_file in "${sum_files[@]}"; do - if [ -f "$sum_file" ]; then - # Check if the dependency is present in the go.sum file - if grep -q "$d" "$sum_file"; then - found=true - break - fi +# Loop through the fallbacks and exceptions +for d in $(jq -ner --argjson data "$license_scout" '$data | (.fallbacks.golang // [])[].name'); do + # Check if the package is in go.sum in any relevant folders + if ! grep -q "$d" go.sum && ! grep -q "$d" protovendor/go.sum && ! grep -q "$d" api/external/go.sum; then + # Check if it's an exception + if echo "$exceptions" | grep -q "$d"; then + echo "Skipping exception for dependency \"$d\"" + else + echo "License_scout exception for dependency \"$d\" not required anymore" + exit 1 fi - done - # If the dependency is not found in any go.sum file, print a message and exit - # commented this since license_scout integration tests requires those dependencies - # if [ "$found" = false ]; then - # echo "license_scout exception for dependency \"$d\" not required anymore" - # exit 1 - # fi + fi done echo "Checking for up-to-date bldr config" @@ -86,4 +79,4 @@ shellcheck -s bash -ax \ .studiorc .studio/* echo "Checking for possible credentials in the source code" -go run ./tools/credscan +go run ./tools/credscan \ No newline at end of file