Hi Paulo, It's tricky when you start, I remember finding this all a bit confusing too!
On 25/01/2013 11:16, Paulo Matos wrote:
* Builds are the files created during a job.
My understanding is that a build is a specific, numbered run of a job.
So if a job triggers the creation of 2 files and 3 directories, that's the build and it exists in the workspace.
Well, the build is a number. Each build uses a workspace, and the job may create files in that workspace. Jenkins keeps a copy of the workspace for each build, unless you configure it not to...
Artifacts are files/directories that are stored by jenkins outside the workspace and can be copied between jobs.
Indeed, although they're still tied to a build. An artifact might be "'mydist.tgz' from build number 10 of the 'make_things' job".
Now, if this is correct, how does it work when we say: 'keep a maximum amount of 5 builds'?
That means "keep up to 5 copies of the workspace, one for each build".
Does jenkins take a snapshot of workspace before a job is run
I think it's after...
and knows what was created during the job execution and makes that the build?
I believe it's just a copy of the workspace as it was, so no knowledge is used...
* If I have a job and create a tarball in a script to use as artifact, the tarball is created in workspace and then the artifact [tarball] is copied automatically by jenkins somewhere else.
If you configure the saving of artifacts as a post action.
However the tarball stays in workspace occupying precious space. How can I instruct jenkins that all that is made into an artifact should be removed from workspace?
I think this might be what you're after: https://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin
* When I run a downstream job and copy artifacts from upstream into workspace/artifacts, is there a way to remove all the artifacts from previous build or this needs to be done manually through a script?
You can also configure how long to keep artifacts in old builds... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk