2017-12-26 12 views
0

ビルダーイメージapp_name:latestを作成して、別のイメージやバイナリソースなどの複数のソース入力を作成し、出力をapp_name:latestに作成します。Openshiftでビルド設定に複数のソース入力を提供するにはどうすればいいですか

例 -

{ 
    "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": {} 
      } 
     ] 
    } 
} 

答えて

1

あなたがチェーン構築と呼ばれるものを使用することができます。次のオプションを使用、画像を作成するためにoc new-buildを使用して

--source-image

--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-pathへの引数は、ファイルがコピーされるイメージの絶対パスと、ソースビルドによって挿入されたアップロードされたファイルのディレクトリ内の相対パス名です。別のイメージのファイルを配置する必要があります。後者は絶対パスにすることはできませんので、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" 
        } 
       ] 
      }, 
      ... 
    }, 
}, 

直接生のビルド構成に追加する場合、複数の映像ソースを持つことができます。コマンドラインでは、1つのみ設定できます。

関連する問題