github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/prow/bump.sh (about) 1 #!/bin/bash 2 # Copyright 2016 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 if [ "$#" -ne 1 ]; then 17 echo "usage: $0 [program]" 18 exit 1 19 fi 20 21 # darwin is great 22 SED=sed 23 if which gsed &>/dev/null; then 24 SED=gsed 25 fi 26 if ! ($SED --version 2>&1 | grep -q GNU); then 27 echo "!!! GNU sed is required. If on OS X, use 'brew install gnu-sed'." 28 exit 1 29 fi 30 31 cd $(dirname $0) 32 33 makefile_version_re="^\(${1}_VERSION.*=\s*\)" 34 version=$($SED -n "s/$makefile_version_re//Ip" Makefile) 35 new_version=$(awk -F. '{print $1 "." $2+1}' <<< $version) 36 37 echo "program: $1" 38 echo "old version: $version" 39 echo "new version: $new_version" 40 41 $SED -i "s/$makefile_version_re.*/\1$new_version/I" Makefile 42 $SED -i "s/\(${1}:\)[0-9.]\+/\1$new_version/I" cluster/*.yaml