Merge "[grafana] Update Dashboard for CPU Usage"
authorEmma Foley <efoley@redhat.com>
Fri, 17 Dec 2021 13:07:10 +0000 (13:07 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Fri, 17 Dec 2021 13:07:10 +0000 (13:07 +0000)
docs/release/release-notes/notes/update-apply-pr-script-46e6d547d331c5f2.yaml [new file with mode: 0644]
src/collectd/collectd_apply_pull_request.sh

diff --git a/docs/release/release-notes/notes/update-apply-pr-script-46e6d547d331c5f2.yaml b/docs/release/release-notes/notes/update-apply-pr-script-46e6d547d331c5f2.yaml
new file mode 100644 (file)
index 0000000..de1be99
--- /dev/null
@@ -0,0 +1,3 @@
+build:
+  - |
+    Update collectd_apply_pull_request.sh to rebase only if multiple chanegs are selected. The script will checkout the PR branch if there's only one PR_ID passed.
index 35af298..403d78d 100755 (executable)
@@ -35,8 +35,16 @@ IFS=', ' read -a PULL_REQUESTS <<< "$COLLECTD_PULL_REQUESTS"
 git config user.email "barometer-experimental@container"
 git config user.name "BarometerExperimental"
 
-for PR_ID in "${PULL_REQUESTS[@]}"
-do
-    echo "Applying pull request $PR_ID"
-    git pull --rebase origin pull/$PR_ID/head
-done
+# If there's a single PR listed, just check it out
+if [ "${#PULL_REQUESTS[@]}" -eq "1" ];
+then
+       echo "Checking out pull request $COLLECTD_PULL_REQUESTS"
+       git fetch origin pull/$COLLECTD_PULL_REQUESTS/head && git checkout FETCH_HEAD
+else
+# if there are multiple PRs, rebase them on top of the checked out branch
+       for PR_ID in "${PULL_REQUESTS[@]}"
+       do
+               echo "Applying pull request $PR_ID"
+               git pull --rebase origin pull/$PR_ID/head
+       done
+fi