Continuous integration GitLab CI无法安装/使用PhantomJS

Continuous integration GitLab CI无法安装/使用PhantomJS,continuous-integration,phantomjs,gitlab,gitlab-ci,Continuous Integration,Phantomjs,Gitlab,Gitlab Ci,我目前正在使用Flask开发一个web应用程序,并且需要在其中一个测试中使用PhantomJS。我将GitLab用于远程git存储库,并将GitLab CI用作CI工具 不幸的是,我似乎无法让GitLab CI的共享运行程序安装并运行PhantomJS。它的输出: my.gitlab ci.yml中的一个片段: image: python:2.7.11 before_script: - ... - mkdir ~/tmp - pushd ~/tmp - wget https:

我目前正在使用Flask开发一个web应用程序,并且需要在其中一个测试中使用PhantomJS。我将GitLab用于远程git存储库,并将GitLab CI用作CI工具

不幸的是,我似乎无法让GitLab CI的共享运行程序安装并运行PhantomJS。它的输出:

my
.gitlab ci.yml
中的一个片段:

image: python:2.7.11

before_script:
  - ...
  - mkdir ~/tmp
  - pushd ~/tmp
  - wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
  - tar xf $PHANTOM_JS.tar.bz2
  - mv $PHANTOM_JS phantomjs
  - ln -s ~/tmp/phantomjs/bin/phantomjs /usr/bin/phantomjs
  - phantomjs --version
  - popd
  - ...
$Phantom_JS
指的是PhantomJS的特定版本

有人知道解决办法吗?或者是否有其他方法来安装和运行PhantomJS


谢谢。

我在ruby图像中也做了类似的事情,我可以确认有时候它只是没有下载预期的zip文件

RUN cd /tmp && \
    curl -OL https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 && \
    tar xjf phantomjs-1.9.8-linux-x86_64.tar.bz2 phantomjs-1.9.8-linux-x86_64/bin/phantomjs && \
    mv phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin && \
    rm -r phantomjs-1.9.8-linux-x86_64*
据我所知,bitbucket URL重定向到一个经过身份验证的S3 URL,有时是404

我已经求助于使用
docker run-it image/bin/bash
在本地运行映像,并在每次构建后使用
which phantomjs
phantomjs--version
验证是否安装了phantomjs。如果安装不起作用,我将重新构建容器


我注意到,在运行容器构建之前在浏览器中点击下载URL(将在本地下载文件)会增加成功的可能性。我很想看到一个“更好”的解决方案。

看来问题出在我自己身上。我之前没有发现Gitlab CI是构建在64位机器上的。我下载的32位版本在运行程序上不起作用。

您应该看到这样的图像:运行程序已成功下载并解压缩tar文件,但之后找不到PhantomJS二进制文件。。。从Bitbucket下载tar文件时,我从来没有遇到过失败。根据我的经验,该文件似乎下载和解压缩正确,但最终生成的文件
/usr/local/bin/phantomjs
不可执行,因此
phantomjs--version
会导致错误。手动运行脚本是我发现在这些情况下下载实际上并不成功的原因。sudo npm install-g phantomjs prebuilded