github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/update_deps.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright (c) 2022 Arista Networks, Inc.
     3  # Use of this source code is governed by the Apache License 2.0
     4  # that can be found in the COPYING file.
     5  
     6  # This script is run periodically by Jenkins to post a review to
     7  # update all of our dependencies and proto files.
     8  
     9  set -eax
    10  
    11  if [[ "$USER" != jenkins ]]; then
    12    echo >&2 "warning: This script is mostly for Jenkins' benefit."
    13    echo >&2 "         It updates dependencies and posts a review to Gerrit."
    14    echo >&2 "         Hit enter to proceed anyway, Ctrl-C to cancel."
    15    test -t 0 && read -rs # Read enter if stdin is a terminal
    16  fi
    17  
    18  set -xe
    19  if ! test -x .git/hooks/commit-msg; then
    20    scp -o BatchMode=yes -p -P 29418 gerrit.corp.arista.io:hooks/commit-msg .git/hooks/
    21  fi
    22  
    23  cd "$(dirname "$0")"
    24  go version
    25  # by default go mod tidy will tidy so that go sum includes checksums needed by one
    26  # version lower than the go version in go.mod
    27  go get -u ./... && go mod tidy -go=1.21
    28  git add go.mod go.sum
    29  
    30  ./refresh_protos.sh
    31  
    32  git commit -m "update dependencies and protos
    33  
    34  Jenkins-Job-Name: $JOB_NAME
    35  Jenkins-Build-Number: $BUILD_NUMBER"