.helmignore 檔案

.helmignore 檔案用於指定您不想包含在 Helm 圖表中的檔案。

如果此檔案存在,則 helm package 命令在封裝您的應用程式時,將會忽略與 .helmignore 檔案中指定的模式相符的所有檔案。

這有助於避免將不必要的或敏感的檔案或目錄添加到您的 Helm 圖表中。

.helmignore 檔案支援 Unix shell glob 匹配、相對路徑匹配和否定(以 ! 為前綴)。每行只會考慮一個模式。

以下是一個 .helmignore 檔案範例

# comment

# Match any file or path named .helmignore
.helmignore

# Match any file or path named .git
.git

# Match any text file
*.txt

# Match only directories named mydir
mydir/

# Match only text files in the top-level directory
/*.txt

# Match only the file foo.txt in the top-level directory
/foo.txt

# Match any file named ab.txt, ac.txt, or ad.txt
a[b-d].txt

# Match any file under subdir matching temp*
*/temp*

*/*/temp*
temp?

與 .gitignore 的一些顯著差異

  • 不支援 '**' 語法。
  • glob 函式庫是 Go 的 'filepath.Match',而不是 fnmatch(3)
  • 結尾空格一律會被忽略(沒有支援的跳脫序列)
  • 不支援將 '!' 作為特殊的開頭序列。
  • 預設情況下,它不會排除自身,您必須為 .helmignore 添加一個明確的條目

我們非常歡迎您提供協助,讓這份文件變得更好。若要新增、更正或移除資訊,請提交 issue或傳送 Pull Request 給我們。