github.com/jenkins-x/test-infra@v0.0.7/hack/verify-deps.sh (about)

     1  #!/bin/bash
     2  # Copyright 2018 The Kubernetes Authors.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -o nounset
    17  set -o errexit
    18  set -o pipefail
    19  
    20  TESTINFRA_ROOT=$(git rev-parse --show-toplevel)
    21  cd "${TESTINFRA_ROOT}"
    22  
    23  _tmpdir="$(mktemp -d -t verify-deps.XXXXXX)"
    24  cd "${_tmpdir}"
    25  _tmpdir="$(pwd)"
    26  
    27  trap "rm -rf ${_tmpdir}" EXIT
    28  
    29  _tmp_gopath="${_tmpdir}/go"
    30  _tmp_testinfra_root="${_tmp_gopath}/src/k8s.io/test-infra"
    31  mkdir -p "${_tmp_testinfra_root}/.."
    32  cp -a "${TESTINFRA_ROOT}" "${_tmp_testinfra_root}/.."
    33  
    34  cd "${_tmp_testinfra_root}"
    35  GOPATH="${_tmp_gopath}" PATH="${_tmp_gopath}/bin:${PATH}" ./hack/update-deps.sh
    36  
    37  diff=$(diff -Nupr \
    38    -x ".git" \
    39    -x "bazel-*" \
    40    -x "_output" \
    41    "${TESTINFRA_ROOT}" "${_tmp_testinfra_root}" 2>/dev/null || true)
    42  
    43  if [[ -n "${diff}" ]]; then
    44    echo "${diff}" >&2
    45    echo >&2
    46    echo "Run ./hack/update-deps.sh" >&2
    47    exit 1
    48  fi