github.com/openshift/installer@v1.4.17/hack/verify-vendor.sh (about)

     1  #!/bin/bash
     2  
     3  # verify_module verifies the vendor of a module
     4  # $1: directory of the module
     5  # $2: golang compatability requirement (optional)
     6  verify_module() {
     7    pushd "$1"
     8    tidy_args=()
     9    [ -n "${2:-}" ] && tidy_args=("-compat=$2")
    10    go mod tidy "${tidy_args[@]}"
    11    go mod vendor
    12    go mod verify
    13    popd
    14  }
    15  
    16  if [ "$IS_CONTAINER" != "" ]; then
    17    set -eux
    18  
    19    # Verify the main installer module.
    20    verify_module "${PWD}"
    21  
    22    # Verify the sub-modules for the terraform providers.
    23    find terraform/providers -maxdepth 1 -mindepth 1 -print0 | while read -r -d '' dir
    24    do
    25      verify_module "$dir"
    26    done
    27    # Verify the terraform sub-module.
    28    verify_module "terraform/terraform"
    29  
    30    find cluster-api/providers -maxdepth 1 -mindepth 1 -print0 | while read -r -d '' dir
    31    do
    32      verify_module "$dir"
    33    done
    34    verify_module "cluster-api/cluster-api"
    35  
    36    git diff --exit-code
    37  else
    38    podman run --rm \
    39      --env IS_CONTAINER=TRUE \
    40      --volume "${PWD}:/go/src/github.com/openshift/installer:z" \
    41      --workdir /go/src/github.com/openshift/installer \
    42      docker.io/golang:1.22 \
    43      ./hack/verify-vendor.sh "${@}"
    44  fi