Jenkins Project Artifacts and Workspace

后端 未结 1 1944
刺人心
刺人心 2021-01-17 10:46

I\'ve used jenkins for quite a few years but have never set it up myself which I did at my new job. There are a couple questions and issues that I ran into.

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 11:42

    It does seem like you are confused about several aspects of Jenkins.. I think your question basically boils down to the following.

    What is a difference between a workspace and a build?

    So, here are some thoughts on this topic:

    1. Builds are historical data. They (usually) don't change like a workspace does during building/checkout.
    2. Builds contain information about a run (e.g. its status, build number, change log, etc) and any artifacts that you tell it to archive (logs, test results, etc). They (usually) don't contain source code like a workspace.
    3. Builds are stored in the Jenkins\jobs\[projectName]\builds\[build_id]\ directory. This is a directory managed by Jenkins and you (usually) do not need to modify anything in this directory. However, workspaces are directories meant for the build and you can do pretty much anything with them and place them anywhere (it does not need to be in the default Jenkins\jobs\[projectName]\workspace directory.
    4. Workspaces should be able to be wiped at any given time. To restore it, just rebuild the job with the same parameters/revision. If you need to keep something after a build, tell Jenkins to archive it before the build is done.
    5. In regard to saving the entire state, I don't think you need to do that. As mentioned in #4, you should be able to reproduce the same build by kicking off the same revision/parameters as the build in question. If you cannot get back to the original state from the same revision/parameters, then that might be something to strive for as debugging is going to be a nightmare. :)
    6. A workspace is an aspect of the project and not a build and that is why there is no link to the workspace from that page. Again, a build is just saved data from a previous run. A project uses the workspace to build stuff and that is why you can get to the workspace from that page.
    7. In regard to how to save artifacts, you must specify the names of the files you want to save. Unless you are trying to save a file called "artifacts", then you should probably use something else. How about **/*.log for all log files? or **/*.xml for all xml files?

    Hope this helps.

    0 讨论(0)
提交回复
热议问题