infra: Fix ownerships for successful runs as well
[releng.git] / jjb / infra / openstack-bifrost-verify.sh
index 42236f0..12b419e 100755 (executable)
@@ -11,6 +11,16 @@ set -o errexit
 set -o nounset
 set -o pipefail
 
+trap fix_ownership EXIT
+
+function fix_ownership() {
+    if [ -z "${JOB_URL+x}" ]; then
+        echo "Not running as part of Jenkins. Handle the logs manually."
+    else
+        chown -R jenkins:jenkins $WORKSPACE
+    fi
+}
+
 # check distro to see if we support it
 # we will have centos and suse supported in future
 case "$DISTRO" in
@@ -45,6 +55,9 @@ cd /opt/bifrost
 cd /opt/bifrost
 ./scripts/test-bifrost-deployment.sh
 
+# fix the ownerships so stuff works even with successful runs
+fix_ownership
+
 # list the provisioned VMs
 cd /opt/bifrost
 source env-vars