Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save jenkins log automatically? #263

Open
jian-hong-wu opened this issue Sep 29, 2021 · 0 comments
Open

How to save jenkins log automatically? #263

jian-hong-wu opened this issue Sep 29, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@jian-hong-wu
Copy link
Owner

pytest 測試 log 存下來可以用 linux 指令導出 output:
1) pytest | tee result.txt ---> 此法log會同時顯示到console和存入檔案中.
2) pytest > result.txt ---> 此法只會將 log 存入檔案中.

並將 log 藉由 docker cp 的方式從 container 裡複製到 server 上:
docker cp <container_name>:result.txt ./ ---> 可以放到 WORKSPACE 底下,便可以夾帶在 Email 中.

之後就可以把 log 做打包,夾帶在 Email 當中:
emailext attachLog: false, attachmentsPattern: "result.txt", ---> 'attachmentsPattern' 這個參數給從 container 複製到 WORKSPACE 底下的檔案,檔案就會被夾帶到附件中.
body: 'Build has finished!',
replyTo: '$DEFAULT_REPLYTO',
subject: '$DEFAULT_SUBJECT',
to: '[email protected]'

@jian-hong-wu jian-hong-wu added the documentation Improvements or additions to documentation label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant