假设我们在 Artifactory
中创建了一个 PyPi
存储库(简单 API)。在 Jenkins 管道内部,由于安全策略的原因,需要使用 JFrog CLI
来发布任何类型的 Artifactory 。
有没有办法使用 JFrog CLI 将 python 包(dist/tar.gz,wheel
)推送到 PyPi 存储库?
最佳答案
是的,你可以。
配置Artifactory:
> jfrog c add
配置项目的解析存储库。您应该设置您创建的虚拟存储库。
> jfrog rt pipc
使用 Artifactory 中的 pip 安装项目依赖项:
> jfrog rt pipi -r requirements.txt --build-name=my-pip-build --build-number=1 --module=jfrog-python-example
打包项目,创建分发文件(tar.gz 和 whl):
> python setup.py sdist bdist_wheel
将包上传到 Artifactory 中的 pypi 存储库:
> jfrog rt u dist/ pypi/ --build-name=my-pip-build --build-number=1 --module=jfrog-python-example
收集环境变量并将它们添加到构建信息中:
> jfrog rt bce my-pip-build 1
将构建信息发布到 Artifactory:
> jfrog rt bp my-pip-build 1
使用 pip 从 Artifactory 安装已发布的包:
> jfrog rt pip-install jfrog-python-example
验证软件包已成功安装:
> pip show jfrog-python-example
更多详细信息列于 Github jfrog/project-examples .
关于python - 如何使用 JFrog CLI 将 python 包发布到 Artifactory PyPi?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71569033/