gpt4 book ai didi

openshift - 如何为 Openshift 中的构建配置提供多个源输入

转载 作者:行者123 更新时间:2023-12-03 08:09:59 26 4
gpt4 key购买 nike

我想创建一个构建器图像 app_name:latest这将采用多个源输入,例如,另一个图像和二进制源,然后将输出创建到 app_name:latest .

示例 -

{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "app_name",
"labels": {
"application": "app_name"
}
},
"spec": {
"source": {
"type": "Git",
"git": {
"uri": "https://github.com/xyz/app_name.git",
"ref": "master"
},
"contextDir": ""
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"namespace": "openshift",
"name": "java-s2i:latest"
}
}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "app_name:latest"
}
},
"triggers": [{
"type": "GitHub",
"generic": {
"secret": "secret"
}
},
{
"type": "Generic",
"github": {
"secret": "secret"
}
},
{
"type": "ImageChange",
"imageChange": {}
}
]
}
}

最佳答案

您可以使用所谓的链式构建。

使用 oc new-build 时要创建图像,请使用以下选项:

--source-image='': Specify an image to use as source for the build. You must also specify --source-image-path.
--source-image-path='': Specify the file or directory to copy from the source image and its destination in the build directory. Format:
--source-image 的参数是从单独构建创建的现有图像流的名称。这可能包含其他预编译的工件或数据文件。
--source-image-path 的参数是从其中复制文件的图像中的绝对路径名,并且是源构建注入(inject)的上传文件目录中的相对路径名,应该放置来自单独图像的文件。后者不能是绝对路径,因此您可能必须覆盖 assemble脚本将其移动到正确的位置。

就原始构建配置中的外观而言,它是:
    "source": {
"git": {
"ref": "master",
"uri": "https://github.com/jakevdp/PythonDataScienceHandbook"
},
"images": [
{
"from": {
"kind": "ImageStreamTag",
"name": "packages-python-27:latest"
},
"paths": [
{
"destinationDir": ".s2i",
"sourcePath": "/opt/app-root/packages"
}
]
},
{
"from": {
"kind": "ImageStreamTag",
"name": "packages-python-35-wheelhouse:latest"
},
"paths": [
{
"destinationDir": ".s2i",
"sourcePath": "/opt/app-root/packages"
}
]
},
...
},
},

直接添加到原始构建配置时,您可以拥有多个图像源。命令行只允许设置一个。

关于openshift - 如何为 Openshift 中的构建配置提供多个源输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47978115/

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