2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
13 : ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'}
14 : ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'}
15 : ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec
17 : ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'}
18 : ${RELENG_REPO_DIR:='/home/opnfv/repos/releng'}
19 # TEMP HACK to freeze releng version to workaround fetch_os_creds.sh problem
20 : ${RELENG_BRANCH:='master'} # branch, tag, sha1 or refspec
22 # git update using reference as a branch.
23 # git_update_branch ref
24 function git_update_branch {
27 git checkout -f origin/${git_branch}
28 # a local branch might not exist
29 git branch -D ${git_branch} || true
30 git checkout -b ${git_branch}
33 # git update using reference as a branch.
34 # git_update_remote_branch ref
35 function git_update_remote_branch {
38 git checkout -b ${git_branch} -t origin/${git_branch}
41 # git update using reference as a tag. Be careful editing source at that repo
42 # as working copy will be in a detached mode
44 function git_update_tag {
48 # fetching given tag only
49 git fetch origin tag ${git_tag}
50 git checkout -f ${git_tag}
59 if [[ -n "$(git show-ref refs/tags/${git_ref})" ]]; then
60 git_update_tag "${git_ref}"
61 elif [[ -n "$(git show-ref refs/heads/${git_ref})" ]]; then
62 git_update_branch "${git_ref}"
63 elif [[ -n "$(git show-ref refs/remotes/origin/${git_ref})" ]]; then
64 git_update_remote_branch "${git_ref}"
65 # check to see if it is a remote ref
66 elif git fetch --tags origin "${git_ref}"; then
68 git checkout FETCH_HEAD
70 # if we are a random commit id we have to unshallow
71 # to get all the commits
72 git fetch --unshallow origin
73 git checkout -f "${git_ref}"
78 echo "INFO: Updating releng -> ${RELENG_BRANCH}"
79 if [ ! -d ${RELENG_REPO_DIR} ]; then
80 git clone ${RELENG_REPO} ${RELENG_REPO_DIR}
83 # reset remote so we know origin is valid
84 git remote set-url origin ${RELENG_REPO}
86 git fetch --tags origin ${RELENG_BRANCH} || true
88 find . -name '*.pyc' -delete
89 git_checkout ${RELENG_BRANCH}
92 echo "INFO: Updating yardstick -> ${YARDSTICK_BRANCH}"
93 if [ ! -d ${YARDSTICK_REPO_DIR} ]; then
94 git clone ${YARDSTICK_REPO} ${YARDSTICK_REPO_DIR}
96 cd ${YARDSTICK_REPO_DIR}
97 git_checkout ${YARDSTICK_BRANCH}
99 # setup the environment
100 source ${YARDSTICK_REPO_DIR}/tests/ci/prepare_env.sh
103 ${YARDSTICK_REPO_DIR}/tests/ci/yardstick-verify $@