[igt-dev] [PATCH i-g-t] gitlab-ci: Run ninja test as non-root

Arkadiusz Hiler arkadiusz.hiler at intel.com
Tue Feb 12 16:58:35 UTC 2019


igt_command_line.sh now fails if it is run as root, which breaks 'ninja
test' in GitLab's CI with our current setup.

There's no convenient means of switching users yet:
 - USER in Dockerfile file won't do it, we would lack permissions for the src
 - each line of script is execute separately, so no `setuid()`
 - no facilities for juggling users in the gitlab-runner itself

So will just `useradd && chmod && su -c "ninja test"` in the testing
steps. At least for now.

Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 .gitlab-ci.yml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4bd4130f..08e8e6cc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -86,7 +86,10 @@ test:ninja-test:
   dependencies:
     - build:tests-fedora
   stage: test
-  script: ninja -C build test
+  script:
+    - useradd igt
+    - chown -R igt:igt build
+    - su igt -c "ninja -C build test"
 
 test:ninja-test-arm64:
   image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-arm64:latest
@@ -96,7 +99,9 @@ test:ninja-test-arm64:
   script:
     - export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/
     - env > build/envdump.txt
-    - ninja -C build test
+    - useradd igt
+    - chown -R igt:igt build
+    - su igt -c "ninja -C build test"
   artifacts:
     paths:
       - build
-- 
2.20.1



More information about the igt-dev mailing list