gpt4 book ai didi

python - jenkinsfile中的诗歌

转载 作者:行者123 更新时间:2023-12-02 12:11:03 24 4
gpt4 key购买 nike

安装程序是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 (Jenkins)运行非交互式 shell ,而您正在尝试启动交互式 shell 。 --no-interaction选项并不意味着非交互式 shell ,而是该 shell 不询问您问题:

  -n (--no-interaction)  Do not ask any interactive question
This answer explains it🔑🔑。
我只是不叫 shell ,而只是使用 poetry run🏃🏃命令:
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"
}

stage('Lint') {
sh "$HOME/.poetry/bin/poetry run 'pre-commit install'"
sh "$HOME/.poetry/bin/poetry run 'pre-commit run --all'"
}
}
}
}
✌️

关于python - jenkinsfile中的诗歌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62961328/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com