go.fuchsia.dev/jiri@v0.0.0-20240502161911-b66513b29486/scripts/update_cipd.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2023 The Fuchsia Authors. All rights reserved.
     3  # Use of this source code is governed by a BSD-style license that can be
     4  # found in the LICENSE file.
     5  
     6  # Script to update the version of the CIPD CLI pinned by Jiri.
     7  
     8  set -eu -o pipefail
     9  
    10  jiri_dir="$( cd "$( dirname "$( dirname "${BASH_SOURCE[0]}" )" )" >/dev/null && pwd )"
    11  
    12  cipd_client_pkg='infra/tools/cipd/${platform}'
    13  
    14  # Resolve the latest version of the CIPD CLI. We can't just do `cipd
    15  # selfupdate-roll -version latest` because the "latest" ref might point to a
    16  # different version for different platforms, so instead we resolve the
    17  # git_revision tag of the "latest" version for the current platform and update
    18  # to that tag for all platforms.
    19  new_version="$(
    20      cipd describe "$cipd_client_pkg" -version latest \
    21      | grep git_revision \
    22      | tail -1)"  # The last tag in the list is the oldest so most likely to exist for all packages.
    23  new_version="$(echo "$new_version" | xargs)" # Trim whitespace
    24  
    25  cipd selfupdate-roll -version-file "$jiri_dir/cipd/cipd_client_version" -version "$new_version"