diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-10-03 15:43:36 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2017-10-20 05:12:15 +0000 |
commit | 324a3cbd69026fa565bbeb174a308456f1ef8fa6 (patch) | |
tree | 9c1fba05183943951c1804d337aa0c6945d65af7 /.gitlab-ci.yml | |
parent | 8cdacab742d0749da45ba2b807f13c59f0bfd18f (diff) | |
download | buildstream-324a3cbd69026fa565bbeb174a308456f1ef8fa6.tar.gz |
.gitlab-ci.yml: Drop root privileges for some tests102-run-ci-as-non-root-user
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1113368f2..66674e839 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,15 +15,19 @@ before_script: - df -h # Store cache in the project directory - - mkdir -p "$(pwd)/cache" + - if [ -d "$(pwd)/cache" ]; then chmod -R a+rw "$(pwd)/cache"; fi - export XDG_CACHE_HOME="$(pwd)/cache" + - adduser -m buildstream + - chown -R buildstream:buildstream . # Run premerge commits # pytest: stage: test script: - - python3 setup.py test --index-url invalid://uri + # We run as a simple user to test for permission issues + - su buildstream -c 'python3 setup.py test --index-url invalid://uri' + - mkdir -p coverage-pytest/ - cp .coverage.* coverage-pytest/coverage.pytest artifacts: @@ -38,7 +42,10 @@ integration_linux: script: - pip3 install --no-index . - cd integration-tests - - ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test + + # We run as a simple user to test for permission issues + - su buildstream -c './run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test' + - cd .. - mkdir -p coverage-linux/ - cp integration-tests/.coverage coverage-linux/coverage.linux @@ -59,7 +66,10 @@ pytest_unix: # disappear unless we mark it as user-installed. - dnf mark install fuse-libs - dnf erase -y bubblewrap ostree + + # Since the unix platform is required to run as root, no user change required - python3 setup.py test --index-url invalid://uri + - mkdir -p coverage-pytest-unix - cp .coverage.* coverage-pytest-unix/coverage.pytest-unix artifacts: @@ -73,7 +83,10 @@ integration_unix: script: - pip3 install --no-index . - cd integration-tests + + # Since the unix platform is required to run as root, no user change required - ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test + - cd .. - mkdir -p coverage-unix/ - cp integration-tests/.coverage coverage-unix/coverage.unix |