If builds are run with a user other than 'jenkins', chown'ing of the
sudoers log will fail. Switching the command to use the current
user (and user's default login group) fixes this.
Note: See chown(1) DESCRIPTION for an explanation of using a colon after
the username while omitting the group
Change-Id: Ia9b96e93a250fd22eb36c94471a06c2e211dc9e3
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
--- /dev/null
+---
+fixes:
+ - |
+ Updates the 'sudo-logs.sh' script to set ownerhsip to current build
+ user and user's login group, instead of the explicit
+ 'jenkins:jenkins'. This will allow sudoer log ownership to work on
+ builders not using 'jenkins' as their build username.
;;
esac
sudo_log=$(basename "$sudo_log")
- sudo chown jenkins:jenkins "/tmp/$sudo_log"
+ sudo chown "$(id -nu)": "/tmp/$sudo_log"
chmod 0644 "/tmp/$sudo_log"
mkdir -p "$WORKSPACE/archives/sudo"
mv "/tmp/$sudo_log" "$WORKSPACE/archives/sudo/$sudo_log"