github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/planter/planter.sh (about)

     1  #!/bin/sh
     2  # Copyright 2017 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  # NOTE: use like: ./planter.sh bazel build //cmd/...
    17  # NOTE: build kubernetes with: <path to test-infra>/planter.sh make bazel-build
    18  
    19  set -o errexit
    20  set -o nounset
    21  IMAGE_NAME="gcr.io/k8s-testimages/planter"
    22  TAG="${TAG:-0.5.4-1}"
    23  IMAGE="${IMAGE_NAME}:${TAG}"
    24  # run our docker image as the host user with bazel cache and current repo dir
    25  REPO=$(git rev-parse --show-toplevel 2>/dev/null || true)
    26  REPO=${REPO:-${PWD}}
    27  VOLUMES="-v ${REPO}:${REPO} -v ${HOME}:${HOME} --tmpfs /tmp:exec,mode=777"
    28  GID="$(id -g ${USER})"
    29  ENV="-e USER=${USER} -e GID=${GID} -e UID=${UID} -e HOME=${HOME}"
    30  docker run --rm ${VOLUMES} --user ${UID} -w ${PWD} ${ENV} ${IMAGE} ${@}