我正在尝试创建用于将代码自动化部署到openshift集群的管道,但是当管道处于安装需求阶段时,在安装mysql时始终会出现错误,是否有可能是错误或我的代码是假的吗?任何帮助或反馈都将非常有用,谢谢!
这是我的jenkinsfile,我在requirements.txt上使用mysqlclient版本1.4.2.post1
pipeline {
agent {
node {label 'python'}
}
environment {
APPLICATION_NAME = 'xxx'
GIT_REPO="https://xxx.git"
GIT_BRANCH="master"
STAGE_TAG = "promoteToQA"
DEV_PROJECT = "dev"
STAGE_PROJECT = "stage"
TEMPLATE_NAME = "xxx"
ARTIFACT_FOLDER = "target"
PORT = 8080;
}
stages {
stage('Get Latest Code') {
steps {
withCredentials([usernamePassword(credentialsId: 'xxx', passwordVariable: 'xxx', usernameVariable: 'xxx')]) {
sh('git pull https://${xxx}:${xxx}@xxx')
}
}
}
stage ("Install Dependencies") {
steps {
sh """
pip install virtualenv
virtualenv --no-site-packages .
source bin/activate
pip install -r requirements.txt
deactivate
"""
}
}
错误输出总是这样
Collecting mysqlclient==1.4.2.post1 (from -r requirements.txt (line 22))
Downloading https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-x0egt255/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/tmp/pip-install-x0egt255/mysqlclient/setup_posix.py", line 51, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-x0egt255/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-x0egt255/mysqlclient/