Merge lp:~chris.macnaughton/ubuntu-openstack-ci/direct-git into lp:ubuntu-openstack-ci

Proposed by Chris MacNaughton
Status: Merged
Merged at revision: 411
Proposed branch: lp:~chris.macnaughton/ubuntu-openstack-ci/direct-git
Merge into: lp:ubuntu-openstack-ci
Diff against target: 62 lines (+28/-2)
2 files modified
run/job-parts/build_func_test.sh (+4/-0)
run/job-parts/osci_gerrit_common.sh (+24/-2)
To merge this branch: bzr merge lp:~chris.macnaughton/ubuntu-openstack-ci/direct-git
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+360914@code.launchpad.net
To post a comment you must log in.
412. By Chris MacNaughton

Add optional TEST_PATH to func runner

413. By Chris MacNaughton

Replace variable check with a default substitution for GIT_BRANCH

Revision history for this message
Liam Young (gnuoy) wrote :

LGTM, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run/job-parts/build_func_test.sh'
2--- run/job-parts/build_func_test.sh 2018-12-13 20:55:35 +0000
3+++ run/job-parts/build_func_test.sh 2018-12-14 08:00:44 +0000
4@@ -19,6 +19,10 @@
5 f_env_set_network_env_vars
6 cd ${BUILT_ASSET_DIR-$CO_DIR}
7
8+if [[ -n $TEST_PATH ]]; then
9+ cd $TEST_PATH
10+fi
11+
12 : ${TOX_SEARCH:="func27|func"}
13 target=$(awk "BEGIN {FS=\":\"} /^\[testenv:("$TOX_SEARCH")\]/ {gsub(/\]/,\"\"); print \$2}" tox.ini)
14
15
16=== modified file 'run/job-parts/osci_gerrit_common.sh'
17--- run/job-parts/osci_gerrit_common.sh 2018-12-13 20:55:35 +0000
18+++ run/job-parts/osci_gerrit_common.sh 2018-12-14 08:00:44 +0000
19@@ -39,7 +39,9 @@
20 fi
21
22 # Detect repo approach and fetch/clone/branch the asset
23- if [[ ! -z "$GERRIT_REFSPEC" ]] && [[ "$GERRIT_CHANGE_NUMBER" != "-1" ]]; then
24+ if [[ ! -z "$GIT_REPO" ]]; then
25+ f_git_checkout_direct
26+ elif [[ ! -z "$GERRIT_REFSPEC" ]] && [[ "$GERRIT_CHANGE_NUMBER" != "-1" ]]; then
27 f_gerrit_git_fetch_refspec
28 elif [[ ! -z "$BASE_NAME" ]] && [[ -z "$BRANCH" ]]; then
29 f_git_clone_by_base_name
30@@ -52,11 +54,31 @@
31 }
32
33
34+function f_git_checkout_direct() {
35+ # Git clone based on GIT_REPO and optional GIT_BRANCH (default to master)
36+ f_line $FUNCNAME
37+
38+ export GIT_BRANCH=${GIT_BRANCH:-"master"}
39+
40+ f_set_co_dir
41+
42+ if [[ -d $CO_DIR ]]; then
43+ echo " - Removing existing checkout @ $CO_DIR"
44+ rm -rf ${CO_DIR:?}
45+ fi
46+
47+ mkdir -p $CO_DIR
48+ echo " + Cloning $GIT_REPO --> $CO_DIR"
49+ git clone $GIT_REPO $CO_DIR -b $GIT_BRANCH --depth 1
50+ f_git_announce_info
51+}
52+
53+
54 function f_git_clone_by_base_name(){
55 # Git clone based on BASE_NAME and optional GIT_BRANCH (default to master)
56 f_line $FUNCNAME
57
58- [[ -z "$GIT_BRANCH" ]] && export GIT_BRANCH="master"
59+ export GIT_BRANCH=${GIT_BRANCH:-"master"}
60
61 if [[ -z "$BASE_NAME" ]]; then
62 echo " ! Missing the required GIT env vars."

Subscribers

People subscribed via source and target branches