您好,我是Iam,致力于在Openshift 3.9上实施CICD。我有一个在openshift中运行的詹金斯豆荚。 Iam在jenkins及更低版本中运行Selenium脚本是Iam变得像缺少软件包一样的错误
Running TestSuite
/var/lib/jenkins/jobs/Pipeline/workspace/src/test/resources/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
Nov 21, 2018 8:25:36 AM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
Tests run: 8, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 21.9 sec <<< FAILURE! - in TestSuite
BrowserSettings(SecurityCheckList) Time elapsed: 21.273 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:25:02.294Z'
System info: host: 'jenkins-1-7zgld', ip: '10.131.0.32', os.name: 'Linux', os.arch: 'i386', os.version: '3.10.0-957.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: ChromeDriver
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:148)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
为此,我想通过以下命令在我的jenkins容器中安装libgconf-2-4
yum install libgconf-2-4
当我尝试安装以下内容时,我的jenkins容器中出现以下错误
sh-4.2$ yum install libgconf2-4
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
[Errno 13] Permission denied: '/etc/pki/entitlement-host'
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.dbenv.lock'
You need to be root to perform this command.
当我转到指定位置并尝试将权限更改为chmod 777 .dbenv.lock
sh-4.2$ cd /var/lib/rpm/
sh-4.2$ ls -latr
total 19560
-rw-r--r--. 1 root root 0 Aug 9 18:21 .dbenv.lock
它抛出错误
sh-4.2$ chmod 777 .dbenv.lock
chmod: changing permissions of ‘.dbenv.lock’: Operation not permitted
我的问题是如何以root用户身份进入jenkins pod并通过yum install libgconf-2-4在openshift中安装rpm软件包libgconf-2-4?
答案 0 :(得分:1)
似乎您应该按如下方式自定义jenkins
图像。[0]
创建Dockerfile
。
FROM registry.access.redhat.com/openshift3/jenkins-2-rhel7 USER 0 RUN yum -y install libgconf2-4 && yum clean all -y USER 1001
使用Dockerfile
构建图像。
docker build .
登录OpenShift
的内部注册表以推送图像。
docker login -u admin -p docker-registry.default.svc:5000
重新标记为OpenShift
图片格式和您的标记政策。
docker tag docker-registry.default.svc:5000/openshift/jenkins-2-rhel7-custom
按下image
。
docker push docker-registry.default.svc:5000/openshift/jenkins-2-rhel7-custom
编辑您的deploymentConfig
oc edit dc/jenkins ... containers: ... image: "openshift/jenkins-2-rhel7-custom" ...
希望它能对您有所帮助。 :^)
答案 1 :(得分:-1)
您可以在您的dockerfile中使用USER root
来解决您的问题