github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/test/build-utils.sh (about)

     1  #!/bin/bash
     2  
     3  #   Copyright The containerd Authors.
     4  
     5  #   Licensed under the Apache License, Version 2.0 (the "License");
     6  #   you may not use this file except in compliance with the License.
     7  #   You may obtain a copy of the License at
     8  
     9  #       http://www.apache.org/licenses/LICENSE-2.0
    10  
    11  #   Unless required by applicable law or agreed to in writing, software
    12  #   distributed under the License is distributed on an "AS IS" BASIS,
    13  #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  #   See the License for the specific language governing permissions and
    15  #   limitations under the License.
    16  
    17  ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
    18  
    19  # PROJECT is the gce project to upload tarball.
    20  PROJECT=${PROJECT:-"k8s-cri-containerd"}
    21  
    22  # GOOGLE_APPLICATION_CREDENTIALS is the path of service account file.
    23  if [ -z ${GOOGLE_APPLICATION_CREDENTIALS} ]; then
    24    echo "GOOGLE_APPLICATION_CREDENTIALS is not set"
    25    exit 1
    26  fi
    27  
    28  # Activate gcloud service account.
    29  gcloud auth activate-service-account --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" --project="${PROJECT}"
    30  
    31  # Install dependent libraries.
    32  apt-get update
    33  if apt-cache show libbtrfs-dev > /dev/null; then
    34    apt-get install -y libbtrfs-dev
    35  else
    36    apt-get install -y btrfs-tools
    37  fi
    38  
    39  # Kubernetes test infra uses jessie and stretch.
    40  if cat /etc/os-release | grep jessie; then
    41    sh -c "echo 'deb http://ftp.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list"
    42    apt-get update
    43    apt-get install -y libseccomp2/jessie-backports
    44    apt-get install -y libseccomp-dev/jessie-backports
    45  else
    46    apt-get install -y libseccomp2
    47    apt-get install -y libseccomp-dev
    48  fi
    49  
    50  # PULL_REFS is from prow.
    51  if [ ! -z "${PULL_REFS:-""}" ]; then
    52    DEPLOY_DIR=$(echo "${PULL_REFS}" | sha1sum | awk '{print $1}')
    53  fi