github.com/abayer/test-infra@v0.0.5/experiment/bump_e2e_image.sh (about)

     1  #!/usr/bin/env bash
     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  # Usage: bump_e2e_image.sh
    17  
    18  set -o errexit
    19  set -o nounset
    20  set -o pipefail
    21  
    22  # darwin is great
    23  SED="sed"
    24  if which gsed &>/dev/null; then
    25    SED="gsed"
    26  fi
    27  if ! ($SED --version 2>&1 | grep -q GNU); then
    28    echo "!!! GNU sed is required.  If on OS X, use 'brew install gnu-sed'." >&2
    29    exit 1
    30  fi
    31  
    32  dirty="$(git status --porcelain)"
    33  if [[ -n ${dirty} ]]; then
    34    echo "Tree not clean:"
    35    echo "${dirty}"
    36    exit 1
    37  fi
    38  
    39  TREE="$(dirname "${BASH_SOURCE[0]}")/.."
    40  
    41  DATE="$(date +v%Y%m%d)"
    42  TAG="${DATE}-$(git describe --tags --always --dirty)"
    43   
    44  make -C "${TREE}/images/kubekins-e2e" push
    45  K8S=experimental make -C "${TREE}/images/kubekins-e2e" push
    46  K8S=1.11 make -C "${TREE}/images/kubekins-e2e" push
    47  K8S=1.10 make -C "${TREE}/images/kubekins-e2e" push
    48  K8S=1.9 make -C "${TREE}/images/kubekins-e2e" push
    49  K8S=1.8 make -C "${TREE}/images/kubekins-e2e" push
    50  
    51  echo "TAG = ${TAG}"
    52  
    53  $SED -i "s/\\/kubekins-e2e:.*$/\\/kubekins-e2e:${TAG}-master/" "${TREE}/images/kubeadm/Dockerfile"
    54  $SED -i "s/\\/kubekins-e2e:v.*$/\\/kubekins-e2e:${TAG}-master/" "${TREE}/experiment/generate_tests.py"
    55  $SED -i "s/\\/kubekins-e2e:v.*-\\(.*\\)$/\\/kubekins-e2e:${TAG}-\\1/" "${TREE}/experiment/test_config.yaml"
    56  
    57  bazel run //experiment:generate_tests -- \
    58    "--yaml-config-path=${TREE}/experiment/test_config.yaml" \
    59    "--output-dir=${TREE}/config/jobs/kubernetes/generated/"
    60  bazel run //jobs:config_sort
    61  
    62  # Scan for kubekins-e2e:v.* as a rudimentary way to avoid
    63  # replacing :latest.
    64  $SED -i "s/\\/kubekins-e2e:v.*-\\(.*\\)$/\\/kubekins-e2e:${TAG}-\\1/" "${TREE}/prow/config.yaml"
    65  find "${TREE}/config/jobs/" -type f -name \*.yaml -exec $SED -i "s/\\/kubekins-e2e:v.*-\\(.*\)$/\\/kubekins-e2e:${TAG}-\\1/" {} \;
    66  git commit -am "Bump to gcr.io/k8s-testimages/kubekins-e2e:${TAG}-(master|experimental|releases) (using generate_tests and manual)"
    67  
    68  # Bump kubeadm image
    69  
    70  TAG="${DATE}-$(git describe --tags --always --dirty)"
    71  make -C "${TREE}/images/kubeadm" push TAG="${TAG}"
    72  
    73  $SED -i "s/\\/e2e-kubeadm:v.*$/\\/e2e-kubeadm:${TAG}/" "${TREE}/prow/config.yaml"
    74  find "${TREE}/config/jobs/" -type f -name \*.yaml -exec $SED -i "s/\\/e2e-kubeadm:v.*-\\(.*\)$/\\/e2e-kubeadm:${TAG}/" {} \;
    75  git commit -am "Bump to e2e-kubeadm:${TAG}"