[CI] add sudo to dockerfile, change dir owner in CI

parent f14c6246
Pipeline #7796 failed with stages
in 43 minutes and 23 seconds
......@@ -25,10 +25,12 @@ cabal:
- dist-newstyle/
- .cabal/
policy: pull-push
before_script:
- sudo chown -R test /builds/gargantext
script:
- git config --global --add safe.directory $XDG_CACHE_HOME/nix/tarball-cache
- git config --global --add safe.directory '*'
- nix-shell --run "./bin/update-project-dependencies && cabal --store-dir=$STORE_DIR v2-build all --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'"
- nix-shell --run "cabal update && ./bin/update-project-dependencies && cabal --store-dir=$STORE_DIR v2-build all --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'"
allow_failure: false
stack:
......@@ -62,17 +64,17 @@ test:
stage: test
# The tests needs to run as the 'test' user, because they leverage the
# initdb utility from postgres that cannot be run by 'root'.
before_script:
- echo "Creating test user..."
- mkdir -p /home/test
- mkdir -p /root/.config
- useradd -U test
- chown -R test:test dist-newstyle/
- chown -R test:test /root/
- chown -R test:test $STORE_DIR
- chown -R test:test ${CABAL_DIR}
- mkdir -p "$XDG_CACHE_HOME/nix"
- chown -R test:test "$XDG_CACHE_HOME/nix"
# before_script:
# - echo "Creating test user..."
# - mkdir -p /home/test
# - mkdir -p /root/.config
# - useradd -U test
# - chown -R test:test dist-newstyle/
# - chown -R test:test /root/
# - chown -R test:test $STORE_DIR
# - chown -R test:test ${CABAL_DIR}
# - mkdir -p "$XDG_CACHE_HOME/nix"
# - chown -R test:test "$XDG_CACHE_HOME/nix"
cache:
key: cabal.project
......
......@@ -32,6 +32,7 @@ ENV PATH=/home/test/.nix-profile/bin:$PATH
ENV PATH=/home/test/.local/bin:$PATH
RUN mkdir -m 0777 /nix && chown test /nix && \
mkdir -p "/builds/gargantext/" && chmod 777 -R "/builds/gargantext"
RUN echo 'test ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER test
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment