github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/mungegithub/publisher/util/deploy.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2017 The Kubernetes 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  set -o errexit
    18  set -o nounset
    19  set -o pipefail
    20  
    21  if [ ! $# -eq 3 ]; then
    22      echo "usage: $0 github_token kubectl_context image_repo"
    23      exit 1
    24  fi
    25  
    26  # Path to github token the robot uses to push changes to repositories.
    27  # Used by the munger's Makefile
    28  export TOKEN="${1}"
    29  # The kubectl context determines where the robot is deployed to.
    30  CONTEXT="${2}"
    31  # The repo to push the docker image of the robot.
    32  # Used by the munger's Makefile
    33  # Use "gcr.io/google_containers" for real deploy.
    34  export REPO="${3}"
    35  
    36  MUNGERS_ROOT=$(dirname "${BASH_SOURCE}")/../..
    37  cd "${MUNGERS_ROOT}"
    38  
    39  echo "${TOKEN}" > token
    40  
    41  kubectl config use-context "${CONTEXT}"
    42  
    43  kubectl delete deployment kubernetes-publisher || true
    44  kubectl delete secret kubernetes-github-token || true
    45  kubectl delete configmap kubernetes-publisher-config || true
    46  export APP=publisher
    47  export TARGET=kubernetes
    48  make clean
    49  make secret
    50  kubectl create -f ./publisher/local.secret.yaml
    51  kubectl create -f ./publisher/deployment/kubernetes/configmap.yaml
    52  export READONLY=false
    53  make deploy