2017-10-17 64 views
0

我想澄清可以添加到我的項目庫中.s2i/bin目錄中的可能腳本。Openshift 3 - 覆蓋.s2i/bin文件 - 彙編並運行腳本

文檔說,當您添加這些文件時,他們將覆蓋項目生成時的默認文件同名。例如,如果我將自己的「彙編」文件放在.s2i/bin目錄中,那麼默認的彙編文件還會運行還是完全被我的腳本替換?如果我想要默認文件的某些行爲?我是否必須將默認的「組裝」內容複製到我的文件中,這樣兩者都會被執行?

回答

0

你需要從你自己的地方調出原始的「彙編」腳本。與此類似

#!/bin/bash -e 
# The assemble script builds the application artifacts from a source and 
# places them into appropriate directories inside the image. 

# Execute the default S2I script 
source ${STI_SCRIPTS_PATH}/assemble 

# You can write S2I scripts in any programming language, as long as the 
# scripts are executable inside the builder image. 
+0

請注意''STI_SCRIPTS_PATH''不是保證設置的環境變量。一些S2I的建設者可能會因歷史原因而設置,但其他人可能不會。所以你需要從圖像中找出位置。對於許多語言構建者而言,它是'/ usr/libexec/s2i'',而其他語言則是'/ usr/local/s2i''。 –

+0

有關添加V2風格動作掛鉤機制的示例,該機制允許在構建和部署的不同階段使用單獨的掛鉤腳本,請參閱https://github.com/getwarped/action-hooks或者,如果使用Python,請參閱https:// pypi.python.org/pypi/powershift-image –

+0

感謝你們倆。 –