Re: [PATCH v4 03/10] github: adapt containerized jobs to be rootless

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Patrick,

On Fri, 10 Jan 2025, Patrick Steinhardt wrote:

> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
> index 900be9957a23fcaa64e1aefd0c8638c5f84b7997..b02f5873a540b458d38e7951b4ee3d5ca598ae23 100644
> --- a/.github/workflows/main.yml
> +++ b/.github/workflows/main.yml
> @@ -371,10 +371,12 @@ jobs:
>        run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6
>      - uses: actions/checkout@v4
>      - run: ci/install-dependencies.sh
> -    - run: ci/run-build-and-tests.sh
> +    - run: useradd builder --create-home
> +    - run: chown -R builder .
> +    - run: sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh

I am afraid that this is not enough. Sure, it works as long as the tests
are passing, but the entire point of running the tests is to catch _and
debug_ when they are failing. Otherwise a lot of money and effort could be
saved simply by deleting those tests.

When the tests are failing, the detailed test logs are supposed to be
shown, but as I noticed most recently in
https://github.com/microsoft/git/actions/runs/17278881863/job/49042596457?pr=787#step:9:1933
there is a fatal error that prevents them from being shown let alone
uploaded:

  [...]
  Test Summary Report
  -------------------
  t5799-gvfs-helper.sh                             (Wstat: 256 Tests: 36 Failed: 1)
    Failed test:  25
    Non-zero exit status: 1
  Files=1040, Tests=31137, 543 wallclock secs ( 8.01 usr  2.16 sys + 611.98 cusr 1100.12 csys = 1722.27 CPU)
  Result: FAIL
  make[1]: *** [Makefile:78: prove] Error 1
  ++ cat exit.status
  make[1]: Leaving directory '/__w/git/git/t'
  make: *** [Makefile:3362: test] Error 2
  + res=2
  + rm exit.status
  + end_group 'Run tests'
  + test -n t
  + set +x
  ci/lib.sh: line 221: /__w/_temp/_runner_file_commands/set_env_cca39642-cc57-484c-b7d4-27bbd4dc8260: Permission denied
  Error: Process completed with exit code 1.

This error causes the next two steps to be skipped, the one that is
supposed to show the detailed test logs, and the one to upload the failed
tests' directories, precluding any further attempt at debugging the test
failures. Even the part of that step that is supposed to show the failed
_test case's_ logs, as a last resort, fails to show anything because it is
skipped because of that error, too.

Due to various reasons, I cannot investigate this any further. At the same
time, I suspect that you need some hack like adding the `builder` user to
some group that has write access to `/__w/_temp/` (which is most likely a
Docker volume that maps to the host's `$RUNNER_TEMP` or some such, and
therefore a `chmod` is unlikely to work, or it might lead to unintended
consequences in later steps of thw workflow) to allow the logic to perform
as desired.

Ciao,
Johannes

>      - name: print test failures
>        if: failure() && env.FAILED_TEST_ARTIFACTS != ''
> -      run: ci/print-test-failures.sh
> +      run: sudo --preserve-env --set-home --user=builder ci/print-test-failures.sh
>      - name: Upload failed tests' directories
>        if: failure() && env.FAILED_TEST_ARTIFACTS != ''
>        uses: actions/upload-artifact@v4
> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
> index d1cb9fa8785388b3674fcea4dd682abc0725c968..ecb5b9d36c20d3e7e96148ac628a96c62642c308 100755
> --- a/ci/install-dependencies.sh
> +++ b/ci/install-dependencies.sh
> @@ -31,7 +31,7 @@ alpine-*)
>  	;;
>  fedora-*|almalinux-*)
>  	dnf -yq update >/dev/null &&
> -	dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
> +	dnf -yq install shadow-utils sudo make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
>  	;;
>  ubuntu-*|ubuntu32-*|debian-*)
>  	# Required so that apt doesn't wait for user input on certain packages.
> 
> -- 
> 2.48.0.rc2.279.g1de40edade.dirty
> 
> 
> 





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux