首页 > 解决方案 > python依赖项仅在CI机器上失败

问题描述

我的詹金斯 CI 已经开始失败。我正在构建一个依赖于我的另一个模块的模块

这是错误消息。它在本地主机上没有失败。构建是使用码头工人完成的

Collecting cryptography>=2.2.1 (from pyOpenSSL==18.0.0->api_common_module==4.0.3->mobile_module)

  Installing build dependencies: started

  Installing build dependencies: finished with status 'error'

  Complete output from command /usr/bin/python2 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3qDpun --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links /tmp/python-packages -- setuptools>=18.5 wheel "cffi>=1.7,!=1.11.3; python_implementation != 'PyPy'":

  Looking in links: /tmp/python-packages

  Collecting setuptools>=18.5

    Could not find a version that satisfies the requirement setuptools>=18.5 (from versions: )

  No matching distribution found for setuptools>=18.5

这是码头文件

FROM alpine:3.6
LABEL project="mobile_module"
LABEL description="Mobile module"

# Install needed packages. Notes:
#   * dumb-init: a proper init system for containers, to reap zombie children
#   * musl: standard C library
#   * linux-headers: commonly needed, and an unusual package name from Alpine.
#   * build-base: used so we include the basic development packages (gcc)
#   * bash: so we can access /bin/bash
#   * git: to ease up clones of repos
#   * ca-certificates: for SSL verification during Pip and easy_install
#   * python: the binaries themselves
#   * python-dev: are used for gevent e.g.
#   * py-setuptools: required only in major version 2, installs easy_install so we can install Pip.

ENV PACKAGES="\
    dumb-init \
    musl \
    linux-headers \
    build-base \
    bash \
    git \
    ca-certificates \
    python2 \
    python2-dev \
    py-setuptools \
    openssh \
    sshpass \
    openssl \
    openssl-dev \
    ansible \
    libffi-dev \
    py2-pip \
    supervisor \
    nginx \
    uwsgi-python \
"

# Add the packages
RUN apk add --update $PACKAGES \
    && rm -rf /var/cache/apk/* \
    && echo

# make some useful symlinks that are expected to exist
RUN if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python2.7 /usr/bin/python; fi \
    && if [[ ! -e /usr/bin/python-config ]]; then ln -sf /usr/bin/python2.7-config /usr/bin/python-config; fi \
    && if [[ ! -e /usr/bin/easy_install ]]; then ln -sf /usr/bin/easy_install-2.7 /usr/bin/easy_install; fi \
    && echo

# Install and upgrade Pip
RUN easy_install pip \
    && pip install --upgrade pip \
    && if [[ ! -e /usr/bin/pip ]]; then ln -sf /usr/bin/pip2.7 /usr/bin/pip; fi \
    && echo

RUN pip install cffi
RUN apk add --no-cache gcc musl-dev

# **company_name** user and group

#RUN getent group www-data
#RUN getent group company_name

RUN adduser -D company_name && adduser company_name company_name
RUN adduser -D www-data -G company_name

# RUN groups www-data
# RUN groups company_name

ENV APP_DIR /var/www/webservice

# Setup uwsgi

RUN mkdir ${APP_DIR} \
    && mkdir -p ${APP_DIR}/.python-eggs \
    && chown -R www-data:www-data ${APP_DIR} \
    && chmod 777 /run/ -R \
    && chmod 777 /root/ -R

WORKDIR ${APP_DIR}

COPY uwsgi/webservice.ini /etc/uwsgi/apps-available/webservice.ini
RUN mkdir /etc/uwsgi/apps-enabled/
RUN ln -f -s /etc/uwsgi/apps-available/webservice.ini /etc/uwsgi/apps-enabled/webservice.ini
RUN pip install uwsgitop

# Setup nginx
RUN chown -R www-data:www-data /var/lib/nginx

# RUN cat /etc/nginx/nginx.conf

COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/webservice /etc/nginx/conf.d/webservice.conf
RUN rm -f /etc/nginx/conf.d/default.conf

RUN ln -sf /dev/stdout /var/log/nginx/access.log \
RUN ln -sf /dev/stderr /var/log/nginx/error.log
RUN mkdir -p /run/nginx

# Install application packages
COPY python-packages /tmp/python-packages
RUN pip install -f /tmp/python-packages --no-index mobile_module
RUN mkdir -p /data/mobile_module/newrelic
COPY newrelic/newrelic.ini /data/mobile_module/newrelic/newrelic.ini

任何想法为什么会这样?

标签: pythondockerjenkins

解决方案


根本原因是PyOpenSSL从升级17.3.018.0. 恢复并解决了。


推荐阅读