我正在嘗試使用存檔功能,但無法下載所有檔案。例如,在詹金斯我看到:

但是,單擊鏈接以將所有檔案下載為 zip,然后解壓縮檔案后,我看到:

我不確定為什么 .gitignore 和 .gitattributes 在我下載它時從 zip 檔案中丟失,但它們存在于 Jenkins 中列出的工件中。
我使用以下命令來歸檔工件:
archiveArtifacts artifacts: "portfolios-deployment_${PACKAGE_VERSION}/**/*", onlyIfSuccessful: true, defaultExcludes: false
uj5u.com熱心網友回復:
archiveArtifacts選項:
歸檔構建工件(例如,分發 zip 檔案或 jar 檔案),以便以后可以下載它們。歸檔檔案可以從 Jenkins 網頁訪問。
這意味著它從作業區獲取工件的副本,并將它們與控制器上的構建日志一起存盤。預計作業區是短暫的,或者其內容將在下一次迭代時被覆寫,因此它們與日志一起保留,直到日志被洗掉。
archiveArifacts有一個Advanced ... 選項:
[ X ] Use default excludes
如果您展開幫助,您將看到詳細資訊:
Artifact archiver 使用 Ant org.apache.tools.ant.DirectoryScanner,它默認排除以下模式: /%*%、 /. git /、 /SCCS、/ .bzr、/. hg /、/. bzrignore 、/ . git , /SCCS/ , /.hg, /.#*, /vssver.scc, /.bzr/ , /._*, /# #,**/ ~, /CVS, /.hgtags, /.svn/ , /.hgignore、/.svn、/.gitignore、/.gitmodules、/.hgsubstate、/.gitattributes、/CVS/、/.hgsub、/.DS_Store、**/.cvsignore _ _ _ _ _ _ _ _ _
此選項允許啟用或禁用默認的 Ant 排除項。
把它關掉,它應該會撿起它們,但也可能包括更多。考慮使用以下模式:
Files to archive [ **,.gitignore,.gitattributes ]。
下載
但是,“(zip 中的所有檔案)”是 Jenkins UI 標準DirectoryBrowserSupport功能的一部分。“瀏覽作業區”中顯示的任何目錄都顯示了下載該頁面內容的選項。“ (zip 中的所有檔案)”也由org.apache.tools.zip功能提供,該功能將使用相同的 Ant FileSet 排除。這同樣適用于Browse Workspace和Browse Artifacts頁面。但是,由于此功能內置在 Jenkins UI 層中,因此似乎沒有任何對 Artifacts 的覆寫。您只需要單獨手動下載它們。
可能值得提交一張票(對于組件:核心,標簽存檔),以便下載“zip 中的所有檔案”尊重“瀏覽工件”中顯示的內容。(這對于作業區本身來說不是可取的行為)。
更普遍:
正如幫助所說,它基于默認的 Ant 排除(一個可修改的串列)。有關其他約定,另請參見Ant FileSet。
Ant is in turn based in unix conventions, where files beginning with a dot "." are "hidden files", typically considered "configuration files' and not generally of interest. The Ant list is more specifically to exclude configuration files which are part of common source control systems (there'd be no need to continually archive .git for example). "dot files" do not show up by default in ls -l; you need to run ls -la (all). That logic also extend to other commands.
Also note that while unix is case sensitive, the default for Ant is "no" to case sensitivity for includes/excludes, which may cause issues if (for some silly reason) you have Foo.java and foo.java, but which is then enabled by default in the archiveArtifacts option.
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/440126.html
標籤:詹金斯
