安装程序是Jenkins在Kubernetes运行。我想整理代码,运行测试,然后构建一个容器。在我的一个构建步骤中安装/运行诗歌时遇到问题
podTemplate(inheritFrom: 'k8s-slave', containers: [
containerTemplate(name: 'py38', image: 'python:3.8.4-slim-buster', ttyEnabled: true, command: 'cat')
])
{
node(POD_LABEL) {
stage('Checkout') {
checkout scm
sh 'ls -lah'
}
container('py38') {
stage('Poetry Configuration') {
sh 'apt-get update && apt-get install -y curl'
sh "curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python"
sh "$HOME/.poetry/bin/poetry install --no-root"
sh "$HOME/.poetry/bin/poetry shell --no-interaction"
}
stage('Lint') {
sh 'pre-commit install'
sh "pre-commit run --all"
}
}
}
}
诗歌安装工作正常,但当我去激活shell时,它失败了
+ /root/.poetry/bin/poetry shell --no-interaction
Spawning shell within /root/.cache/pypoetry/virtualenvs/truveris-version-Zr2qBFRU-py3.8
[error]
(25, 'Inappropriate ioctl for device')
这里的问题是Jenkins运行一个非交互式shell,而您正试图启动一个交互式shell。
no-interaction
选项并不意味着非交互式shell,而是指不向您提问的shell:This answer explains it🔑🔑.
我不会调用shell,而是使用
poetry run
🏃🏃 命令:✌️
在容器级别安装poetry,然后使用解析poetry.lock文件
然后用
pip install -r requirements.txt
而不是poetry install
安装依赖项这样就不必在虚拟环境中运行命令
相关问题 更多 >
编程相关推荐