[microsoft/playwright][Jenkins Docker] 无法运行 FF 测试 - /lib64/libstdc++.so 丢失

2024-04-10 779 views
5

你好,

我想在 Jenkins 机器上使用 Firefox 运行我的 PW 测试。虽然在 Chrome 上运行时一切正常,但在 FF 上运行时出现错误。

Env:Jenkins:在 Linux 从属设备上运行测试 Playwright:1.30.0 Docker 文件:mcr.microsoft.com/playwright:v1.30.0-focal

詹金斯管道片段:

stages {
    stage("Setup") {
            steps {
                script {
                    env.DOCKER_PLAYWRIGHT_NAME = "${env.BRANCH_NAME}".replaceAll('/', '-')
                    sh "(docker stop ${env.DOCKER_PLAYWRIGHT_NAME} && docker rm ${env.DOCKER_PLAYWRIGHT_NAME}) || true"
                    sh "docker run -d --name ${env.DOCKER_PLAYWRIGHT_NAME} -it --rm --ipc=host ${env.DOCKER_PLAYWRIGHT_IMAGE} /bin/bash"
                    sh "docker logs -f ${env.DOCKER_PLAYWRIGHT_NAME} &> docker.log &"
                    sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npm i playwright-firefox"
                    sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npx playwright install firefox"
                    sh "npm install"
                    sh 'npx playwright install'
                }
            }
        }

      stage('UI tests') {
        steps {             
                catchError(buildResult: "UNSTABLE", stageResult: "FAILURE") {
                    sh "npm run firefox"   // behind is npx playwright test --config=playwright.config.ts --project=Firefox
                }
            }
      }

我得到的错误是:

browserType.launch: Browser.enable): Browser closed.
    ==================== Browser output: ====================
    <launching> /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-kMNCB9 -juggler-pipe -silent
    <launched> pid=21608
    [pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
    [pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
    [pid=21608] <process did exit: exitCode=1, signal=null>
    [pid=21608] starting temporary directories cleanup
    =========================== logs ===========================
    <launching> /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-kMNCB9 -juggler-pipe -silent
    <launched> pid=21608
    [pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
    [pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
    [pid=21608] <process did exit: exitCode=1, signal=null>
    [pid=21608] starting temporary directories cleanup
    ============================================================

它说/usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found所以这就是为什么我使用命令再次强制将其安装到此 docker 容器内

sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npm i playwright-firefox"
sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npx playwright install firefox"

但这没有效果。

你能帮忙吗?

回答

2

/usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox意味着您尝试在 Jenkins 服务器上运行 Firefox,这是您不应该做的事情。尝试使用官方Docker 镜像来运行它。

npm install / npx playwright install / npm run firefox 应该发生在 Docker 内部。

请参阅此处有关 Docker Jenkins 指南:https://playwright.dev/docs/ci#jenkins

4

是的你是对的。

之前我的管道中有这个 Linux 节点,然后在阶段运行 docker 镜像

agent {
        node(label: "nks01333")
    }

现在我更改为这个并看到构建在 Windows 机器上运行

agent {
         docker { image 'mcr.microsoft.com/playwright:v1.30.0-focal' }
    }

但出现错误

D:\jenkinsslavecode\workspace\ture_feature_check_file_upload_2>docker inspect -f . "mcr.microsoft.com/playwright:v1.30.0-focal" 
'docker' is not recognized as an internal or external command,

这是否意味着我们的 Windows 机器上没有安装 docker,我能做的就是联系我们的 Jenkins 管理员来安装它吗?或者我可以尝试更多吗?

2

谢谢。

我认为最后一个问题是因为我是 Docker 新手,没有这方面的经验。难道为了这个剧作家形象就必须选择Winwodw机器吗?或者我可以以某种方式指示选择我们安装了 Docker 的 Linux 之一吗?这个镜像可以在 Linux 上使用吗?

2

因此,您可以决定使用什么操作系统来运行 Jenkins 机器。如果您决定使用我们推荐的 Docker,因为它可以轻松安装所有 Playwright 浏览器依赖项,那么您可以选择 Linux 或 Windows。 Linux 更轻量级且更易于维护,因此我们通常建议这样做。但根据您的内部 IT 的不同,它可能会有所不同或者存在一些偏好。

7

“如果您决定使用我们推荐的 Docker,因为它可以轻松安装所有 Playwright 浏览器依赖项,那么您可以选择 Linux 或 Windows。

所以我现在的情况是,我使用 Docker 作为代理的构建默认选择 Windows 机器运行。我们那里没有安装 Docker,这导致了前面的错误,所以我希望它选择一个 Linux 从属服务器。

我在管道中尝试了这个,其中 nks 是 Linux 从属设备

 agent {
         docker { 
            image 'mcr.microsoft.com/playwright:v1.30.0-focal' 
            label 'nks01333'
         }
    }

在构建控制台日志中我发现

+ docker inspect -f . mcr.microsoft.com/playwright:v1.30.0-focal
.
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] withDockerContainer
nks01333 (Linux) does not seem to be running inside a container
$ docker run -t -d -u 32339:32339 -w /usr/data/jenkins2/workspace/eature_feature_check_file_upload -v /usr/data/jenkins2/workspace/eature_feature_check_file_upload:/usr/data/jenkins2/workspace/eature_feature_check_file_upload:rw,z -v /usr/data/jenkins2/workspace/eature_feature_check_file_upload-tmp:/usr/data/jenkins2/workspace/eature_feature_check_file_upload-tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** mcr.microsoft.com/playwright:v1.30.0-focal cat
$ docker top d641cccff5efda9a3abdd6f6c4d7184ef33beacb8d3037b21c825f9bfc564613 -eo pid,comm

当进行测试时,他们挂断了,没有结果,我不得不中止它 图像

这是他们的正确运作方式吗?

7

您可以通过设置以下环境变量来调试它们挂起的原因:DEBUG=pw:browser,pw:api如果没有帮助,您还可以设置DEBUG=pw:protocol.请随意将输出发布在问题中,然后我们可以看一下。

9
 pw:api => selectors.setTestIdAttribute started +0ms
  pw:api => browserType.launch started +2ms
  pw:api <= selectors.setTestIdAttribute succeeded +3ms
  pw:api => selectors.setTestIdAttribute started +0ms
  pw:api => browserType.launch started +2ms
  pw:api <= selectors.setTestIdAttribute succeeded +4ms
  pw:api => selectors.setTestIdAttribute started +0ms
  pw:api => browserType.launch started +3ms
  pw:api <= selectors.setTestIdAttribute succeeded +3ms
  pw:api => selectors.setTestIdAttribute started +0ms
  pw:api => browserType.launch started +2ms
  pw:api <= selectors.setTestIdAttribute succeeded +4ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-7PT3Ot -juggler-pipe -silent +0ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-CvQz8Z -juggler-pipe -silent +0ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-NNHsyV -juggler-pipe -silent +0ms
  pw:browser <launched> pid=976 +5ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-qBR6k2 -juggler-pipe -silent +0ms
  pw:browser <launched> pid=977 +5ms
  pw:browser <launched> pid=978 +7ms
  pw:browser <launched> pid=981 +5ms
  pw:browser [pid=977][err] *** You are running in headless mode. +207ms
  pw:browser [pid=978][err] *** You are running in headless mode. +204ms
  pw:browser [pid=976][err] *** You are running in headless mode. +210ms
  pw:browser [pid=981][err] *** You are running in headless mode. +204ms
  pw:browser [pid=978][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317109) [GFX1-]: glxtest: libpci missing +105ms
  pw:browser [pid=978][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317109) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317196) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=978][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317109) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317196) |[2][GFX1-]: No GPUs detected via PCI (t=0.317224) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=977][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.311782) [GFX1-]: glxtest: libpci missing +107ms
  pw:browser [pid=977][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.311782) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.311862) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=977][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.311782) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.311862) |[2][GFX1-]: No GPUs detected via PCI (t=0.311884) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=976][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.312181) [GFX1-]: glxtest: libpci missing +105ms
  pw:browser [pid=976][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.312181) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.312249) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=976][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.312181) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.312249) |[2][GFX1-]: No GPUs detected via PCI (t=0.312269) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=981][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317063) [GFX1-]: glxtest: libpci missing +105ms
  pw:browser [pid=981][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317063) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317128) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=981][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317063) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317128) |[2][GFX1-]: No GPUs detected via PCI (t=0.317147) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=977][err] Unable to revert mtime: /ms-playwright/firefox-1372/firefox/fonts +114ms
  pw:browser [pid=977][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +188ms
  pw:browser [pid=976][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +304ms
  pw:browser [pid=978][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +306ms
  pw:browser [pid=978][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=978][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +0ms
  pw:browser [pid=976][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +5ms
  pw:browser [pid=978][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=976][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=976][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=977][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +11ms
  pw:browser [pid=977][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=977][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=981][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +320ms
  pw:browser [pid=981][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +4ms
  pw:browser [pid=981][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=981][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=978][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +47ms
  pw:browser [pid=977][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +40ms
  pw:browser [pid=981][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +30ms
  pw:browser [pid=976][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +48ms
  pw:browser [pid=978][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317109) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317196) |[2][GFX1-]: No GPUs detected via PCI (t=0.317224) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.692664) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +21ms
  pw:browser [pid=977][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.311782) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.311862) |[2][GFX1-]: No GPUs detected via PCI (t=0.311884) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.687824) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +23ms
  pw:browser [pid=981][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.317063) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.317128) |[2][GFX1-]: No GPUs detected via PCI (t=0.317147) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.697847) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +24ms
  pw:browser [pid=976][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.312181) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.312249) |[2][GFX1-]: No GPUs detected via PCI (t=0.312269) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.69774) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +26ms
  pw:browser [pid=976][err]  +60s
  pw:browser [pid=976][err] (firefox-default:976): dconf-CRITICAL **: 12:44:22.655: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. +1ms
  pw:browser [pid=976][err]  +0ms
  pw:browser [pid=976][err] (firefox-default:976): dconf-CRITICAL **: 12:44:22.656: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. +0ms
5

不幸的是一切都没有改变。错误还是几乎一样

 pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-l4wgGK -juggler-pipe -silent +0ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-AWSZWP -juggler-pipe -silent +0ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-8iAvpI -juggler-pipe -silent +0ms
  pw:browser <launched> pid=949 +6ms
  pw:browser <launched> pid=952 +10ms
  pw:browser <launched> pid=953 +7ms
  pw:browser <launching> /ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-AGgMOf -juggler-pipe -silent +0ms
  pw:browser <launched> pid=979 +10ms
  pw:browser [pid=949][err] *** You are running in headless mode. +231ms
  pw:browser [pid=952][err] *** You are running in headless mode. +231ms
  pw:browser [pid=953][err] *** You are running in headless mode. +231ms
  pw:browser [pid=979][err] *** You are running in headless mode. +177ms
  pw:browser [pid=979][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.305589) [GFX1-]: glxtest: libpci missing +116ms
  pw:browser [pid=979][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.305589) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.305693) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=979][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.305589) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.305693) |[2][GFX1-]: No GPUs detected via PCI (t=0.305721) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=949][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.369939) [GFX1-]: glxtest: libpci missing +125ms
  pw:browser [pid=949][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.369939) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.369999) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=949][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.369939) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.369999) |[2][GFX1-]: No GPUs detected via PCI (t=0.370019) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=952][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.368291) [GFX1-]: glxtest: libpci missing +124ms
  pw:browser [pid=952][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.368291) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.368359) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=952][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.368291) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.368359) |[2][GFX1-]: No GPUs detected via PCI (t=0.368403) [GFX1-]: No GPUs detected via PCI +1ms
  pw:browser [pid=953][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.359706) [GFX1-]: glxtest: libpci missing +124ms
  pw:browser [pid=953][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.359706) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.359778) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
  pw:browser [pid=953][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.359706) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.359778) |[2][GFX1-]: No GPUs detected via PCI (t=0.359796) [GFX1-]: No GPUs detected via PCI +0ms
  pw:browser [pid=979][err] Unable to revert mtime: /ms-playwright/firefox-1372/firefox/fonts +136ms
  pw:browser [pid=949][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +305ms
  pw:browser [pid=979][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +177ms
  pw:browser [pid=953][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +313ms
  pw:browser [pid=952][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +314ms
  pw:browser [pid=949][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +14ms
  pw:browser [pid=949][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=953][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +6ms
  pw:browser [pid=953][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=949][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +3ms
  pw:browser [pid=953][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=979][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +17ms
  pw:browser [pid=979][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +1ms
  pw:browser [pid=952][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +17ms
  pw:browser [pid=979][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=952][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=952][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +2ms
  pw:browser [pid=979][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +29ms
  pw:browser [pid=952][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +26ms
  pw:browser [pid=949][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +39ms
  pw:browser [pid=952][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.368291) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.368359) |[2][GFX1-]: No GPUs detected via PCI (t=0.368403) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.743856) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +13ms
  pw:browser [pid=953][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. +55ms
  pw:browser [pid=979][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.305589) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.305693) |[2][GFX1-]: No GPUs detected via PCI (t=0.305721) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.690682) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +24ms
  pw:browser [pid=949][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.369939) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.369999) |[2][GFX1-]: No GPUs detected via PCI (t=0.370019) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.766418) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +33ms
  pw:browser [pid=953][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.359706) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.359778) |[2][GFX1-]: No GPUs detected via PCI (t=0.359796) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.763673) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt +25ms
  pw:browser [pid=952][err]  +60s
  pw:browser [pid=952][err] (firefox-default:952): dconf-CRITICAL **: 14:07:38.909: unable to create directory '/root/.cache/dconf': Permission denied.  dconf will not work properly. +1ms
0

添加参数“-u pwuser”后,它现在挂在“npm install”命令上,该命令是代理启动后的第一个命令,几分钟后抛出

process apparently never started in /usr/data/jenkins2/workspace/eature_feature_check_file_upload-tmp/durable-6b7e634e
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)

我会用谷歌搜索,但如果有其他建议 - 我会尝试一下。从下周二开始我就可以坐下来讨论这个问题了,所以请不要关闭这张票。

9

@slavika 看起来好像是 Jenkins 出了问题,而我们对 Jenkins 并不熟悉。看起来我们在这里帮不了什么忙。

我建议在其他地方询问这个问题 - 无论是在 Jenkins 论坛上,还是在https://aka.ms/playwright/discord上。也许那里的人更有经验并且能够提供帮助。

由于我们可以在这里提供的建议/帮助不多,所以关闭此内容!但如果您认为我们仍然可以提供帮助,请随时提出新问题。

3

对于任何寻找此问题的人,这里是我们如何让它在 Jenkins 上运行的解决方案。

  • 从 Playwright docker 映像创建派生 Dockerfile。这将添加一个新用户,该用户与 Jenkins 使用的用户相同。使用您常用的 Playwright Docker 映像作为基础映像(在我们的示例中为 Java 映像)。
FROM playwright/java:v1.33.0-focal

ARG JENKINS_USERNAME
ARG JENKINS_UID

RUN adduser --uid $JENKINS_UID $JENKINS_USERNAME
  • 在 Jenkins 中构建并运行派生的 Dockerfile,将当前 Jenkins 用户作为构建参数传递。与任何其他 Jenkinsfile 一样,将此文件适应您的设置/需求。这是用于说明目的的示例:
pipeline {
  agent any

  stages {

    stage('Playwright') {

      agent {
        dockerfile {
          dir 'path/to/your/dockerfile'
          reuseNode true  // or false, depending on your needs; see Jenkinsfile docs

          // This is the important one. Note this is a plain string, not an interpolated GString. The interpolation happens on the command line.
          additionalBuildArgs '--build-arg JENKINS_USERNAME=$(id -un) --build-arg JENKINS_UID=$(id -u)'

          args ' ... '  // any other args for running the image; see Playwright docs in Docker section for details
        }
      }

      steps {
        // run your tests here as usually
      }
    }
  }
}