git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2 5/5] travis-ci: don't fail if user already exists on 32 bit Linux build job

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jan 29, 2018, 17:17 UTC
Message-ID
<20180129171713.17471-6-szeder.dev@gmail.com>
In-Reply-To
<20180129171713.17471-1-szeder.dev@gmail.com>

The 32 bit Linux build job runs in a Docker container, which lends itself to running and debugging locally, too. Especially during debugging one usually doesn't want to start with a fresh container every time, to save time spent on installing a bunch of dependencies. However, that doesn't work quite smootly, because the script running in the container always creates a new user, which then must be removed every time before subsequent executions, or the build script fails.

Make this process more convenient and don't try to create that user if it already exists and has the right user ID in the container, so developers don't have to bother with running a 'userdel' each time before they run the build script.

The build job on Travis CI always starts with a fresh Docker container, so this change doesn't make a difference there.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 ci/run-linux32-build.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ci/run-linux32-build.sh b/ci/run-linux32-build.sh
index 8c1b500e6..2c60d2e70 100755
--- a/ci/run-linux32-build.sh
+++ b/ci/run-linux32-build.sh
@@ -33,7 +33,13 @@ then
 	CI_USER=root
 else
 	CI_USER=ci
-	useradd -u $HOST_UID $CI_USER
+	if test "$(id -u $CI_USER 2>/dev/null)" = $HOST_UID
+	then
+		echo "user '$CI_USER' already exists with the requested ID $HOST_UID"
+	else
+		useradd -u $HOST_UID $CI_USER
+	fi
+
 	# Due to a bug the test suite was run as root in the past, so
 	# a prove state file created back then is only accessible by
 	# root.  Now that bug is fixed, the test suite is run as a
-- 
2.16.1.158.ge6451079d
Previous: SZEDER GáborNext: SZEDER Gábor
Message 4 of 7 in “[PATCHv2 0/5] Travis CI: don't run the test suite as root in the 32 bit Linux build”
  1. SZEDER GáborJan 29, 2018
  2. 1/5 travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux buildSZEDER Gábor, Jan 29, 2018
  3. 3/5 travis-ci: don't repeat the path of the cache directorySZEDER Gábor, Jan 29, 2018
  4. 5/5 travis-ci: don't fail if user already exists on 32 bit Linux build jobSZEDER Gábor, Jan 29, 2018
  5. 2/5 travis-ci: use 'set -e' in the 32 bit Linux build jobSZEDER Gábor, Jan 29, 2018
  6. 4/5 travis-ci: don't run the test suite as root in the 32 bit Linux buildSZEDER Gábor, Jan 29, 2018
  7. Jeff KingJan 29, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.